Skip to content

Commit

Permalink
make flag descriptions more consistent with style used in kargo cli
Browse files Browse the repository at this point in the history
Signed-off-by: Kent Rancourt <[email protected]>
  • Loading branch information
krancour committed Mar 20, 2024
1 parent 2bdea8b commit 8a62aa3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
43 changes: 24 additions & 19 deletions cmd/root_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,60 +59,58 @@ func (o *rootOptions) addFlags(cmd *cobra.Command) {
&o.AllowEmpty,
flagAllowEmpty,
false,
"allow the rendered manifests to be empty; if false this is disallowed as "+
"a safeguard against scenarios where a bug of any kind might otherwise "+
"cause Kargo Render to wipe out the contents of the target branch in "+
"error",
"Allow the rendered manifests to be empty. If not specified, this is "+
"disallowed as a safeguard.",
)

cmd.Flags().StringVarP(
&o.commitMessage,
flagCommitMessage,
"m",
"",
"specify a custom message to be used for the commit to the target branch",
"A custom message to be used for the commit to the target branch.",
)

cmd.Flags().BoolVarP(
&o.debug,
flagDebug,
"d",
false,
"display debug output",
"Display debug output.",
)

cmd.Flags().StringArrayVarP(
&o.Images,
flagImage,
"i",
nil,
"specify a new image to apply to the final result (this flag may be "+
"used more than once)",
"An image to be incorporated into the final result. This flag may be "+
"used more than once.",
)

cmd.Flags().StringVarP(
&o.outputFormat,
flagOutput,
"o",
"",
"specify a format for command output (json or yaml)",
"Specify a format for command output (json or yaml).",
)

cmd.Flags().StringVarP(
&o.Ref,
flagRef,
"R",
"",
"specify a branch or a precise commit to render from; if this is not "+
"provided, Kargo Render renders from HEAD",
"A branch or a precise commit in the remote gitops repository to use as "+
"input. If this is not provided, Kargo Render renders from HEAD.",
)

cmd.Flags().StringVarP(
&o.RepoURL,
flagRepo,
"r",
"",
"the URL of a remote gitops repo (required)",
"The URL of a remote gitops repository.",
)
if err := cmd.MarkFlagRequired(flagRepo); err != nil {
panic(fmt.Errorf("could not mark %s flag as required", flagRepo))
Expand All @@ -123,9 +121,9 @@ func (o *rootOptions) addFlags(cmd *cobra.Command) {
flagRepoPassword,
"p",
"",
"password or token for reading from and writing to the remote gitops "+
"repo (required; can also be set using the KARGO_RENDER_REPO_PASSWORD "+
"environment variable)",
"Password or token for reading from and writing to the remote gitops "+
"repository. Can alternatively be specified using the "+
"KARGO_RENDER_REPO_PASSWORD environment variable.",
)
if err := cmd.MarkFlagRequired(flagRepoPassword); err != nil {
panic(fmt.Errorf("could not mark %s flag as required", flagRepoPassword))
Expand All @@ -136,20 +134,27 @@ func (o *rootOptions) addFlags(cmd *cobra.Command) {
flagRepoUsername,
"u",
"",
"username for reading from and writing to the remote gitops repo "+
"(required; can also be set using the KARGO_RENDER_REPO_USERNAME "+
"environment variable)",
"Username for reading from and writing to the remote gitops repository. "+
"Can alternatively be specified using the KARGO_RENDER_REPO_USERNAME "+
"environment variable.",
)
if err := cmd.MarkFlagRequired(flagRepoUsername); err != nil {
panic(fmt.Errorf("could not mark %s flag as required", flagRepoUsername))
}

cmd.Flags().BoolVar(
&o.Stdout,
flagStdout,
false,
"Write rendered manifests to stdout instead of the remote gitops repo.",
)

cmd.Flags().StringVarP(
&o.TargetBranch,
flagTargetBranch,
"t",
"",
"the branch to render manifests into (required)",
"The branch of the remote gitops repository to write rendered manifests into.",
)
if err := cmd.MarkFlagRequired(flagTargetBranch); err != nil {
panic(fmt.Errorf("could not mark %s flag as required", flagTargetBranch))
Expand Down
2 changes: 1 addition & 1 deletion cmd/version_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (o *versionOptions) addFlags(cmd *cobra.Command) {
flagOutput,
"o",
"",
"specify a format for command output (json or yaml)",
"Specify a format for command output (json or yaml).",
)
}

Expand Down

0 comments on commit 8a62aa3

Please sign in to comment.