Remove flag from PR list
This commit is contained in:
parent
77a610f071
commit
8f1aa9c864
2 changed files with 4 additions and 23 deletions
|
|
@ -43,7 +43,6 @@ func init() {
|
|||
prListCmd.Flags().StringP("base", "B", "", "Filter by base branch")
|
||||
prListCmd.Flags().StringSliceP("label", "l", nil, "Filter by labels")
|
||||
prListCmd.Flags().StringP("assignee", "a", "", "Filter by assignee")
|
||||
prListCmd.Flags().StringP("author", "A", "", "Filter by author")
|
||||
|
||||
prCmd.AddCommand(prViewCmd)
|
||||
prViewCmd.Flags().BoolP("web", "w", false, "Open a pull request in the browser")
|
||||
|
|
@ -226,20 +225,13 @@ func prList(cmd *cobra.Command, args []string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
author, err := cmd.Flags().GetString("author")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if author != "" && !web {
|
||||
return errors.New("the --author flag is currently supported only with the --web flag")
|
||||
}
|
||||
|
||||
if web {
|
||||
prListURL := fmt.Sprintf(
|
||||
"https://github.com/%s/pulls",
|
||||
ghrepo.FullName(baseRepo),
|
||||
)
|
||||
openURL, err := listURLWithQuery(prListURL, "pr", state, assignee, labels, author, baseBranch)
|
||||
openURL, err := listURLWithQuery(prListURL, "pr", state, assignee, labels, "", baseBranch)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -480,17 +480,6 @@ func TestPRList_withInvalidLimitFlag(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestPRList_AuthorWithoutWebFlag(t *testing.T) {
|
||||
initBlankContext("", "OWNER/REPO", "master")
|
||||
http := initFakeHTTP()
|
||||
http.StubRepoResponse("OWNER", "REPO")
|
||||
|
||||
_, err := RunCommand(`pr list --author abc`)
|
||||
if err == nil && err.Error() != "the --author flag is currently supported only with the --web flag" {
|
||||
t.Errorf("error running command `issue list`: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPRList_web(t *testing.T) {
|
||||
initBlankContext("", "OWNER/REPO", "master")
|
||||
http := initFakeHTTP()
|
||||
|
|
@ -503,19 +492,19 @@ func TestPRList_web(t *testing.T) {
|
|||
})
|
||||
defer restoreCmd()
|
||||
|
||||
output, err := RunCommand("pr list --web -a peter -A john -l bug -l docs -L 10 -s merged -B trunk")
|
||||
output, err := RunCommand("pr list --web -a peter -l bug -l docs -L 10 -s merged -B trunk")
|
||||
if err != nil {
|
||||
t.Errorf("error running command `pr list` with `--web` flag: %v", err)
|
||||
}
|
||||
|
||||
eq(t, output.String(), "")
|
||||
eq(t, output.Stderr(), "Opening https://github.com/OWNER/REPO/pulls?q=is%3Apr+is%3Amerged+assignee%3Apeter+label%3Abug+label%3Adocs+author%3Ajohn+base%3Atrunk+ in your browser.\n")
|
||||
eq(t, output.Stderr(), "Opening https://github.com/OWNER/REPO/pulls?q=is%3Apr+is%3Amerged+assignee%3Apeter+label%3Abug+label%3Adocs+base%3Atrunk+ in your browser.\n")
|
||||
|
||||
if seenCmd == nil {
|
||||
t.Fatal("expected a command to run")
|
||||
}
|
||||
url := seenCmd.Args[len(seenCmd.Args)-1]
|
||||
eq(t, url, "https://github.com/OWNER/REPO/pulls?q=is%3Apr+is%3Amerged+assignee%3Apeter+label%3Abug+label%3Adocs+author%3Ajohn+base%3Atrunk+")
|
||||
eq(t, url, "https://github.com/OWNER/REPO/pulls?q=is%3Apr+is%3Amerged+assignee%3Apeter+label%3Abug+label%3Adocs+base%3Atrunk+")
|
||||
}
|
||||
|
||||
func TestPRView_Preview(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue