Merge pull request #249 from github/issue-pr-argument-docs

Avoid saying "number as argument" for `issue/pr view`
This commit is contained in:
Nate Smith 2020-01-23 09:31:18 -06:00 committed by GitHub
commit 91ab3086a8
3 changed files with 2 additions and 6 deletions

View file

@ -68,7 +68,7 @@ var issueViewCmd = &cobra.Command{
Use: "view {<number> | <url> | <branch>}",
Args: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return errors.New("requires an issue number as an argument")
return FlagError{errors.New("issue required as argument")}
}
return nil
},

View file

@ -285,10 +285,6 @@ func prView(cmd *cobra.Command, args []string) error {
} else {
pr, err = api.PullRequestForBranch(apiClient, baseRepo, branchWithOwner)
if err != nil {
var notFoundErr *api.NotFoundError
if errors.As(err, &notFoundErr) {
return fmt.Errorf("%s. To open a specific pull request use the pull request's number as an argument", err)
}
return err
}

View file

@ -359,7 +359,7 @@ func TestPRView_noResultsForBranch(t *testing.T) {
defer restoreCmd()
_, err := RunCommand(prViewCmd, "pr view")
if err == nil || err.Error() != `no open pull requests found for branch "blueberries". To open a specific pull request use the pull request's number as an argument` {
if err == nil || err.Error() != `no open pull requests found for branch "blueberries"` {
t.Errorf("error running command `pr view`: %v", err)
}