diff --git a/cmd/restic/cmd_generate.go b/cmd/restic/cmd_generate.go index 2e944ad37..b284767ca 100644 --- a/cmd/restic/cmd_generate.go +++ b/cmd/restic/cmd_generate.go @@ -90,7 +90,11 @@ func writePowerShellCompletion(file string) error { return cmdRoot.GenPowerShellCompletionFile(file) } -func runGenerate(cmd *cobra.Command, args []string) error { +func runGenerate(_ *cobra.Command, args []string) error { + if len(args) > 0 { + return errors.Fatal("the generate command expects no arguments, only options - please see `restic help generate` for usage and flags") + } + if genOpts.ManDir != "" { err := writeManpages(genOpts.ManDir) if err != nil { diff --git a/cmd/restic/cmd_init.go b/cmd/restic/cmd_init.go index c01fada16..213c7e898 100644 --- a/cmd/restic/cmd_init.go +++ b/cmd/restic/cmd_init.go @@ -50,6 +50,10 @@ func init() { } func runInit(ctx context.Context, opts InitOptions, gopts GlobalOptions, args []string) error { + if len(args) > 0 { + return errors.Fatal("the init command expects no arguments, only options - please see `restic help init` for usage and flags") + } + var version uint if opts.RepositoryVersion == "latest" || opts.RepositoryVersion == "" { version = restic.MaxRepoVersion