-
Couldn't load subscription status.
- Fork 7.3k
Print friendly error when "gh repo clone" is missing required argument #2253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2e5141b to
af1d8a6
Compare
There was a problem hiding this 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.
pkg/cmd/repo/clone/clone.go
Outdated
| 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")} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
pkg/cmd/repo/clone/clone.go
Outdated
| 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")} |
There was a problem hiding this comment.
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?
There was a problem hiding this 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.
This fixes #2216