Skip to content

Commit 0845816

Browse files
authored
Merge pull request #87 from weaveworks/dynamic-command-name
Allow dynamic command Use generation.
2 parents fccf977 + 5116170 commit 0845816

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

cmd/gitopssets-cli/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ func main() {
1111
Short: "GitOpsSets CLI",
1212
}
1313

14-
rootCmd.AddCommand(cmd.NewGenerateCommand())
14+
rootCmd.AddCommand(cmd.NewGenerateCommand("generate"))
1515
cobra.CheckErr(rootCmd.Execute())
1616
}

pkg/cmd/command.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ import (
3030
)
3131

3232
// NewGenerateCommand creates and returns a new Command that renders GitOpsSets.
33-
func NewGenerateCommand() *cobra.Command {
33+
func NewGenerateCommand(name string) *cobra.Command {
3434
var enabledGenerators []string
3535
var disableClusterAccess bool
3636

3737
cmd := &cobra.Command{
38-
Use: "generate [filename]",
38+
Use: fmt.Sprintf("%s [filename]", name),
3939
Short: "Render GitOpsSet from the CLI",
4040
Args: cobra.ExactArgs(1),
4141
RunE: func(cmd *cobra.Command, args []string) error {

0 commit comments

Comments
 (0)