From f58dd040745ee68d54e21ddcba01ccaf0f358a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Thu, 23 Jan 2020 13:06:21 +0100 Subject: [PATCH] Avoid saying "number as argument" for `issue/pr view` Since issue URLs, PR URLs, and PR branch names are all accepted as arguments, avoid explicitly requesting "number" as argument. --- command/issue.go | 2 +- command/pr.go | 4 ---- command/pr_test.go | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/command/issue.go b/command/issue.go index 139ab3337..ab966fa97 100644 --- a/command/issue.go +++ b/command/issue.go @@ -68,7 +68,7 @@ var issueViewCmd = &cobra.Command{ Use: "view { | | }", 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 }, diff --git a/command/pr.go b/command/pr.go index 5204c1b3d..7b31faf51 100644 --- a/command/pr.go +++ b/command/pr.go @@ -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, ¬FoundErr) { - return fmt.Errorf("%s. To open a specific pull request use the pull request's number as an argument", err) - } return err } diff --git a/command/pr_test.go b/command/pr_test.go index 5a324cab1..9c17c3d4f 100644 --- a/command/pr_test.go +++ b/command/pr_test.go @@ -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) }