Skip to content

Commit ec07d07

Browse files
authored
PBM-1466 cobra fixes (#1085)
* remove unwanted completion cmd * check arguments
1 parent 7b57df8 commit ec07d07

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

cmd/pbm-agent/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ func rootCommand() *cobra.Command {
5959
},
6060
}
6161

62+
rootCmd.CompletionOptions.DisableDefaultCmd = true
63+
6264
setRootFlags(rootCmd)
6365
return rootCmd
6466
}

cmd/pbm/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ func newPbmApp() *pbmApp {
117117
SilenceUsage: true,
118118
}
119119

120+
app.rootCmd.CompletionOptions.DisableDefaultCmd = true
121+
120122
app.rootCmd.PersistentFlags().String(
121123
mongoConnFlag,
122124
"",
@@ -385,6 +387,10 @@ func (app *pbmApp) buildConfigCmd() *cobra.Command {
385387

386388
func (app *pbmApp) buildConfigProfileCmd() *cobra.Command {
387389
runListConfigProfileCmd := app.wrapRunE(func(cmd *cobra.Command, args []string) (fmt.Stringer, error) {
390+
if len(args) != 0 {
391+
return nil, errors.New(fmt.Sprintf("parse command line parameters: unexpected %s", args[0]))
392+
}
393+
388394
return handleListConfigProfiles(app.ctx, app.pbm)
389395
})
390396

0 commit comments

Comments
 (0)