From 2a503050e9b2852f8dd759339d8ddadee01288f5 Mon Sep 17 00:00:00 2001 From: Arjun Vikram Date: Thu, 1 Oct 2020 15:45:16 -0500 Subject: [PATCH] Alias 'hub pr', 'hub issue', 'hub release' with no arguments to 'hub pr list', 'hub issue list', 'hub release list' - fix issue #2478 --- commands/issue.go | 28 ++++++++++++++++++++++++++-- commands/pr.go | 8 +++----- commands/release.go | 23 +++++++++++++++++++++-- 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/commands/issue.go b/commands/issue.go index 89edd2eab..399bca99e 100644 --- a/commands/issue.go +++ b/commands/issue.go @@ -17,7 +17,7 @@ var ( cmdIssue = &Command{ Run: listIssues, Usage: ` -issue [-a ] [-c ] [-@ ] [-s ] [-f ] [-M ] [-l ] [-d ] [-o [-^]] [-L ] +issue list [-a ] [-c ] [-@ ] [-s ] [-f ] [-M ] [-l ] [-d ] [-o [-^]] [-L ] issue show [-f ] issue create [-oc] [-m |-F ] [--edit] [-a ] [-M ] [-l ] issue update [-m |-F ] [--edit] [-a ] [-M ] [-l ] [-s ] @@ -28,7 +28,10 @@ issue transfer ## Commands: -With no arguments, show a list of open issues. +With no arguments, performs ''hub issue list'' + + * _list_: + Show a list of open issues for the current repository. * _show_: Show an existing issue specified by . @@ -196,6 +199,26 @@ hub-pr(1), hub(1) `, } + cmdListIssue = &Command{ + Key: "list", + Run: listIssues, + KnownFlags: ` + -a, --assignee USER + -s, --state STATE + -f, --format FMT + -M, --milestone NAME + -c, --creator USER + -@, --mentioned USER + -l, --labels LIST + -d, --since DATE + -o, --sort KEY + -^, --sort-ascending + --include-pulls + -L, --limit N + --color +`, + } + cmdCreateIssue = &Command{ Key: "create", Run: createIssue, @@ -249,6 +272,7 @@ hub-pr(1), hub(1) ) func init() { + cmdIssue.Use(cmdListIssue) cmdIssue.Use(cmdShowIssue) cmdIssue.Use(cmdCreateIssue) cmdIssue.Use(cmdLabel) diff --git a/commands/pr.go b/commands/pr.go index 17610afca..72e1ac0c0 100644 --- a/commands/pr.go +++ b/commands/pr.go @@ -13,7 +13,7 @@ import ( var ( cmdPr = &Command{ - Run: printHelp, + Run: listPulls, Usage: ` pr list [-s ] [-h ] [-b ] [-o [-^]] [-f ] [-L ] pr checkout [] @@ -25,6 +25,8 @@ pr merge [-d] [--squash | --rebase] [-m | -F ] [--he ## Commands: +With no arguments, performs ''hub pr list'' + * _list_: List pull requests in the current repository. @@ -227,10 +229,6 @@ func init() { CmdRunner.Use(cmdPr) } -func printHelp(command *Command, args *Args) { - utils.Check(command.UsageError("")) -} - func listPulls(cmd *Command, args *Args) { localRepo, err := github.LocalRepo() utils.Check(err) diff --git a/commands/release.go b/commands/release.go index 08b5b6555..f48199846 100644 --- a/commands/release.go +++ b/commands/release.go @@ -17,7 +17,7 @@ var ( cmdRelease = &Command{ Run: listReleases, Usage: ` -release [--include-drafts] [--exclude-prereleases] [-L ] [-f ] +release list [--include-drafts] [--exclude-prereleases] [-L ] [-f ] release show [-f ] release create [-dpoc] [-a ] [-m |-F ] [-t ] release edit [] @@ -28,7 +28,13 @@ release delete ## Commands: -With no arguments, shows a list of existing releases. +With no arguments, performs ''hub release list'' + + * _list_: + Show a list of existing releases for the current repository. + + With --include-drafts, include draft releases in the listing. With + --prereleases, exclude non-stable releases from the listing. * _show_: Show GitHub release notes for . @@ -172,6 +178,18 @@ hub(1), git-tag(1) `, } + cmdListRelease = &Command{ + Key: "list", + Run: listReleases, + KnownFlags: ` + -d, --include-drafts + -p, --exclude-prereleases + -L, --limit N + -f, --format FMT + --color +`, + } + cmdShowRelease = &Command{ Key: "show", Run: showRelease, @@ -227,6 +245,7 @@ hub(1), git-tag(1) ) func init() { + cmdRelease.Use(cmdListRelease) cmdRelease.Use(cmdShowRelease) cmdRelease.Use(cmdCreateRelease) cmdRelease.Use(cmdEditRelease)