diff --git a/pkg/cmd/repo/clone/clone.go b/pkg/cmd/repo/clone/clone.go index 1b474111a..9faa0da59 100644 --- a/pkg/cmd/repo/clone/clone.go +++ b/pkg/cmd/repo/clone/clone.go @@ -35,16 +35,18 @@ func NewCmdClone(f *cmdutil.Factory, runF func(*CloneOptions) error) *cobra.Comm } cmd := &cobra.Command{ - Use: "clone [] -- [...]", + DisableFlagsInUseLine: true, + + Use: "clone [] [-- ...]", Args: cobra.MinimumNArgs(1), Short: "Clone a repository locally", - Long: heredoc.Doc( - `Clone a GitHub repository locally. + Long: heredoc.Doc(` + Clone a GitHub repository locally. If the "OWNER/" portion of the "OWNER/REPO" repository argument is omitted, it defaults to the name of the authenticating user. - To pass 'git clone' flags, separate them with '--'. + Pass additional 'git clone' flags by listing them after '--'. `), RunE: func(cmd *cobra.Command, args []string) error { opts.Repository = args[0] @@ -62,7 +64,7 @@ func NewCmdClone(f *cmdutil.Factory, runF func(*CloneOptions) error) *cobra.Comm if err == pflag.ErrHelp { return err } - return &cmdutil.FlagError{Err: fmt.Errorf("%v\nSeparate git clone flags with `--`.", err)} + return &cmdutil.FlagError{Err: fmt.Errorf("%w\nSeparate git clone flags with '--'.", err)} }) return cmd diff --git a/pkg/cmd/repo/clone/clone_test.go b/pkg/cmd/repo/clone/clone_test.go index 96bb2bad1..54aa2f1cb 100644 --- a/pkg/cmd/repo/clone/clone_test.go +++ b/pkg/cmd/repo/clone/clone_test.go @@ -181,11 +181,8 @@ func Test_RepoClone_withoutUsername(t *testing.T) { } func Test_RepoClone_flagError(t *testing.T) { - reg := &httpmock.Registry{} - httpClient := &http.Client{Transport: reg} - - _, err := runCloneCommand(httpClient, "--depth 1 OWNER/REPO") - if err == nil || err.Error() != "unknown flag: --depth\nSeparate git clone flags with `--`." { + _, err := runCloneCommand(nil, "--depth 1 OWNER/REPO") + if err == nil || err.Error() != "unknown flag: --depth\nSeparate git clone flags with '--'." { t.Errorf("unexpected error %v", err) } }