Skip to content

Provide better error message for gh repo clone#1475

Merged
mislav merged 5 commits intocli:trunkfrom
shihanng:issue-1456__clone-flag-help
Aug 11, 2020
Merged

Provide better error message for gh repo clone#1475
mislav merged 5 commits intocli:trunkfrom
shihanng:issue-1456__clone-flag-help

Conversation

@shihanng
Copy link
Contributor

@shihanng shihanng commented Aug 1, 2020

Summary

An attempt to close #1456

Details

  • Mention <gitflags> in the usage text of the repo clone subcommand.
  • Mention git clone flags when unknown flag is detected in the repo clone subcommand. This approach override the default SetFlagErrorFunc in root to provide the custom message for gh repo clone command.

cli/command/root.go

Lines 74 to 79 in bb6851c

RootCmd.SetFlagErrorFunc(func(cmd *cobra.Command, err error) error {
if err == pflag.ErrHelp {
return err
}
return &cmdutil.FlagError{Err: err}
})

@shihanng shihanng marked this pull request as ready for review August 1, 2020 10:30
@mislav mislav force-pushed the issue-1456__clone-flag-help branch from 1c9a857 to 00bdedb Compare August 11, 2020 15:06
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.

Thank you for the contribution!

@mislav mislav merged commit 9f5daec into cli:trunk Aug 11, 2020
@shihanng shihanng deleted the issue-1456__clone-flag-help branch August 11, 2020 21:39
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.

Add --depth flag to clone

3 participants