diff --git a/cmd/compose/list.go b/cmd/compose/list.go index 618ad03c76e..d4d53b7261e 100644 --- a/cmd/compose/list.go +++ b/cmd/compose/list.go @@ -46,6 +46,7 @@ func listCommand(backend api.Service) *cobra.Command { RunE: Adapt(func(ctx context.Context, args []string) error { return runList(ctx, backend, lsOpts) }), + Args: cobra.NoArgs, ValidArgsFunction: noCompletion(), } lsCmd.Flags().StringVar(&lsOpts.Format, "format", "pretty", "Format the output. Values: [pretty | json].") diff --git a/cmd/compose/restart.go b/cmd/compose/restart.go index f691c31fb55..0600798d39a 100644 --- a/cmd/compose/restart.go +++ b/cmd/compose/restart.go @@ -40,6 +40,7 @@ func restartCommand(p *projectOptions, backend api.Service) *cobra.Command { RunE: Adapt(func(ctx context.Context, args []string) error { return runRestart(ctx, backend, opts, args) }), + Args: cobra.NoArgs, ValidArgsFunction: serviceCompletion(p), } flags := restartCmd.Flags() diff --git a/cmd/compose/version.go b/cmd/compose/version.go index 30e0e753e57..06aff04d975 100644 --- a/cmd/compose/version.go +++ b/cmd/compose/version.go @@ -37,7 +37,7 @@ func versionCommand() *cobra.Command { cmd := &cobra.Command{ Use: "version", Short: "Show the Docker Compose version information", - Args: cobra.MaximumNArgs(0), + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { runVersion(opts) return nil