Skip to content

Commit

Permalink
Use arg not option for name in function config update
Browse files Browse the repository at this point in the history
Also fix usage text for config delete.
  • Loading branch information
willpusher committed Jun 5, 2023
1 parent 30d5df4 commit d771a08
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions commands/channels/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ func NewConfigCreateCommand(functionService api.FunctionService) (*cobra.Command

func NewConfigUpdateCommand(functionService api.FunctionService) (*cobra.Command, error) {
cmd := &cobra.Command{
Use: "update",
Use: "update <config_name>",
Short: "Update a function config for a Channels app",
Args: cobra.NoArgs,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
config, err := functionService.UpdateFunctionConfig(commands.AppID, commands.FunctionConfigName, commands.FunctionConfigDescription, commands.FunctionConfigContent)
config, err := functionService.UpdateFunctionConfig(commands.AppID, args[0], commands.FunctionConfigDescription, commands.FunctionConfigContent)
if err != nil {
return err
}
Expand All @@ -118,13 +118,8 @@ func NewConfigUpdateCommand(functionService api.FunctionService) (*cobra.Command
},
}
cmd.PersistentFlags().BoolVar(&commands.OutputAsJSON, "json", false, "")
cmd.PersistentFlags().StringVar(&commands.FunctionConfigName, "name", "", "Function config name. Can only contain A-Za-z0-9-_")
err := cmd.MarkPersistentFlagRequired("name")
if err != nil {
return nil, err
}
cmd.PersistentFlags().StringVar(&commands.FunctionConfigDescription, "description", "", "Function config description")
err = cmd.MarkPersistentFlagRequired("description")
err := cmd.MarkPersistentFlagRequired("description")
if err != nil {
return nil, err
}
Expand All @@ -138,7 +133,7 @@ func NewConfigUpdateCommand(functionService api.FunctionService) (*cobra.Command

func NewConfigDeleteCommand(functionService api.FunctionService) *cobra.Command {
cmd := &cobra.Command{
Use: "delete",
Use: "delete <config_name>",
Short: "Delete a function config from a Channels app",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down

0 comments on commit d771a08

Please sign in to comment.