💅 Tweak wording

This commit is contained in:
Mislav Marohnić 2020-08-11 17:05:15 +02:00
parent d876cf15b0
commit 00bdedb418
2 changed files with 9 additions and 10 deletions

View file

@ -35,16 +35,18 @@ func NewCmdClone(f *cmdutil.Factory, runF func(*CloneOptions) error) *cobra.Comm
}
cmd := &cobra.Command{
Use: "clone <repository> [<directory>] -- [<gitflags>...]",
DisableFlagsInUseLine: true,
Use: "clone <repository> [<directory>] [-- <gitflags>...]",
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

View file

@ -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)
}
}