diff --git a/cmd/docs/main.go b/cmd/docs/main.go index 0ffcce76..9309a0b8 100644 --- a/cmd/docs/main.go +++ b/cmd/docs/main.go @@ -78,7 +78,7 @@ func mapCommandInfos(cmds []*cobra.Command) []CommandInfo { Name: f.Name, Shorthand: f.Shorthand, Default: f.DefValue, - Type: f.Value.Type(), + Type: valueTypeToString(f.Value), Description: f.Usage, }) }) @@ -88,3 +88,14 @@ func mapCommandInfos(cmds []*cobra.Command) []CommandInfo { return infos } + +func valueTypeToString(v pflag.Value) string { + t := v.Type() + switch t { + case "stringArray": + return "[]string" + default: + return t + } + +} diff --git a/cmd/docs/templates/schema.tmpl b/cmd/docs/templates/schema.tmpl index acc97d71..96a044a3 100644 --- a/cmd/docs/templates/schema.tmpl +++ b/cmd/docs/templates/schema.tmpl @@ -10,7 +10,7 @@ | `sources` | `[]string` | | A list of URLs to source code for this recipe. | | `initHelp` | `string` | | A message which will be showed to an user after a succesful recipe execution. Can be used to guide the user what should be done next in the project directory. | | `ignorePatterns` | `[]string` | | Glob patterns for ignoring generated files from future recipe upgrades. Ignored files will not be regenerated even if their templates change in future versions of the recipe. | -| `vars` | `[]Variable` | | An array of variables which can be used in templates. | +| `vars` | [`[]Variable`](#variable) | | An array of variables which can be used in templates. | ### Variable @@ -22,7 +22,7 @@ | `confirm` | `bool` | `false` | If set to true, the prompt will be yes/no question, and the value type will be boolean. | | `optional` | `bool` | `false` | If set to true, the variable can be left empty. | | `options` | `[]string` | | The user selects the value from a list of options. | -| `validators` | `[]Validator` | | Validators for the variable. | +| `validators` | [`[]Validator`](#validator) | | Validators for the variable. | | `if` | `string` | | Makes the variable conditional based on the result of the expression. The result of the evaluation needs to be a boolean value. Uses https://github.com/antonmedv/expr. | | `columns` | `[]string` | | Set the variable as a table type with columns defined by this property. | diff --git a/internal/cli/pull.go b/internal/cli/pull.go index 7c2dec6b..ceca70d0 100644 --- a/internal/cli/pull.go +++ b/internal/cli/pull.go @@ -22,7 +22,7 @@ func NewPullCmd() *cobra.Command { var cmd = &cobra.Command{ Use: "pull URL", Short: "Pull a recipe from OCI repository", - Long: "Pull a recipe from OCI repository and save it locally. You can authenticate by using the --username and --password flags or logging in first with `docker login`.", + Long: "Pull a recipe from OCI repository and save it locally. You can authenticate by using the `--username` and `--password` flags or logging in first with `docker login`.", Args: cobra.ExactArgs(1), PreRunE: func(cmd *cobra.Command, args []string) error { opts.TargetRef = args[0] diff --git a/internal/cli/push.go b/internal/cli/push.go index 821d1007..19beec12 100644 --- a/internal/cli/push.go +++ b/internal/cli/push.go @@ -20,7 +20,7 @@ func NewPushCmd() *cobra.Command { var cmd = &cobra.Command{ Use: "push RECIPE_PATH TARGET_URL", Short: "Push a recipe to OCI repository", - Long: "Push a recipe to OCI repository (e.g. Docker registry). You can authenticate by using the --username and --password flags or logging in first with `docker login`.", + Long: "Push a recipe to OCI repository (e.g. Docker registry). You can authenticate by using the `--username` and `--password` flags or logging in first with `docker login`.", Args: cobra.ExactArgs(2), PreRunE: func(cmd *cobra.Command, args []string) error { opts.RecipePath = args[0] diff --git a/internal/cli/upgrade.go b/internal/cli/upgrade.go index 0c551de3..06ea37f5 100644 --- a/internal/cli/upgrade.go +++ b/internal/cli/upgrade.go @@ -103,7 +103,12 @@ func runUpgrade(cmd *cobra.Command, opts upgradeOptions) { return } - cmd.Printf("Upgrading recipe %s from version %s to %s\n", oldSauce.Recipe.Name, oldSauce.Recipe.Metadata.Version, re.Metadata.Version) + cmd.Printf( + "Upgrading recipe %s from version %s to %s\n", + oldSauce.Recipe.Name, + oldSauce.Recipe.Metadata.Version, + re.Metadata.Version, + ) // Check if the new version of the recipe has removed some variables // which existed on previous version