forked from TrueCloudLab/restic
init/generate: check that no parameters are passed
This commit is contained in:
parent
22c9276719
commit
03b9764bce
2 changed files with 9 additions and 1 deletions
|
@ -90,7 +90,11 @@ func writePowerShellCompletion(file string) error {
|
||||||
return cmdRoot.GenPowerShellCompletionFile(file)
|
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 != "" {
|
if genOpts.ManDir != "" {
|
||||||
err := writeManpages(genOpts.ManDir)
|
err := writeManpages(genOpts.ManDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -50,6 +50,10 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func runInit(ctx context.Context, opts InitOptions, gopts GlobalOptions, args []string) error {
|
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
|
var version uint
|
||||||
if opts.RepositoryVersion == "latest" || opts.RepositoryVersion == "" {
|
if opts.RepositoryVersion == "latest" || opts.RepositoryVersion == "" {
|
||||||
version = restic.MaxRepoVersion
|
version = restic.MaxRepoVersion
|
||||||
|
|
Loading…
Add table
Reference in a new issue