Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@emhagman
Copy link
Contributor

This fixes #2216

@emhagman emhagman force-pushed the repo-clone-friendly-error branch from 2e5141b to af1d8a6 Compare October 22, 2020 03:24
Copy link
Contributor

@shrihankp shrihankp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this looks good to me.

Use: "clone <repository> [<directory>] [-- <gitflags>...]",
Args: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return &cmdutil.FlagError{Err: errors.New("cannot clone: no repository name given")}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mislav Any suggestions on the copy?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there! Maybe will use var like this

var (
      NoRepositoryNameErr = errors.New("cannot clone: no repository name given")
)
...
return &cmdutil.FlagError{Err: NoRepositoryNameErr}

and use this var here
https://github.com/cli/cli/pull/2253/files#diff-04c817e85387cae5077e022373e3a27f375cac7d29ed6abbe331337433442fd5R216

Use: "clone <repository> [<directory>] [-- <gitflags>...]",
Args: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return &cmdutil.FlagError{Err: errors.New("cannot clone: no repository name given")}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mislav Any suggestions on the copy?

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emhagman Thank you for your contribution! I've pushed a change that changes the error message to say "repository argument" instead of "repository name", since the argument is typically the repository OWNER/NAME pair, or even a full URL.

@mislav mislav merged commit 5e89036 into cli:trunk Oct 29, 2020
@mislav mislav mentioned this pull request Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh repo clone: Make the error message more useful, if the <repository> argument isn't passed.

4 participants