Warn when passing git flags without repository arg
This commit is contained in:
parent
c6938941d5
commit
97aa0b2f7d
1 changed files with 7 additions and 2 deletions
|
|
@ -50,8 +50,13 @@ func NewCmdFork(f *cmdutil.Factory, runF func(*ForkOptions) error) *cobra.Comman
|
|||
}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "fork [<repository>] [-- <gitflags>...]",
|
||||
Args: cobra.MaximumNArgs(2),
|
||||
Use: "fork [<repository>] [-- <gitflags>...]",
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
if cmd.ArgsLenAtDash() == 0 && len(args[1:]) > 0 {
|
||||
return cmdutil.FlagError{Err: fmt.Errorf("repository argument required when passing 'git clone' flags")}
|
||||
}
|
||||
return nil
|
||||
},
|
||||
Short: "Create a fork of a repository",
|
||||
Long: `Create a fork of a repository.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue