feat: add FlagErrorf for missing flag cases
This commit is contained in:
parent
eb2da16b60
commit
9e1d34f473
1 changed files with 4 additions and 0 deletions
|
|
@ -44,6 +44,10 @@ func NewCmdRename(f *cmdutil.Factory, runf func(*RenameOptions) error) *cobra.Co
|
|||
opts.Selector = args[0]
|
||||
opts.OldFileName = args[1]
|
||||
opts.NewFileName = args[2]
|
||||
} else if len(args) == 2 {
|
||||
return cmdutil.FlagErrorf("<newFilename> is missing")
|
||||
} else if len(args) == 1 {
|
||||
return cmdutil.FlagErrorf("<oldFilename> and <newFilename> are missing")
|
||||
} else {
|
||||
return cmdutil.FlagErrorf("not enough arguments")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue