Skip to content

Commit 4de0a76

Browse files
Merge pull request cli#141 from github/add-url-branch-to-usage
Add better usage docs for `gh pr view` `gh pr checkout` `gh issue view`
2 parents e9cbf8f + 5f90cdc commit 4de0a76

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

command/issue.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,18 @@ func init() {
3030
issueCmd.AddCommand(issueListCmd)
3131
issueListCmd.Flags().StringP("assignee", "a", "", "Filter by assignee")
3232
issueListCmd.Flags().StringSliceP("label", "l", nil, "Filter by label")
33-
issueListCmd.Flags().StringP("state", "s", "", "Filter by state (open|closed|all)")
33+
issueListCmd.Flags().StringP("state", "s", "", "Filter by state: {open|closed|all}")
3434
issueListCmd.Flags().IntP("limit", "L", 30, "Maximum number of issues to fetch")
3535
}
3636

3737
var issueCmd = &cobra.Command{
3838
Use: "issue",
3939
Short: "Create and view issues",
40-
Long: `Work with GitHub issues`,
40+
Long: `Work with GitHub issues.
41+
42+
An issue can be supplied as argument in any of the following formats:
43+
- by number, e.g. "123"; or
44+
- by URL, e.g. "https://github.com/<owner>/<repo>/issues/123".`,
4145
}
4246
var issueCreateCmd = &cobra.Command{
4347
Use: "create",
@@ -55,7 +59,7 @@ var issueStatusCmd = &cobra.Command{
5559
RunE: issueStatus,
5660
}
5761
var issueViewCmd = &cobra.Command{
58-
Use: "view <issue-number>",
62+
Use: "view {<number> | <url> | <branch>}",
5963
Args: cobra.MinimumNArgs(1),
6064
Short: "View an issue in the browser",
6165
RunE: issueView,

command/pr.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func init() {
2525
prCmd.AddCommand(prViewCmd)
2626

2727
prListCmd.Flags().IntP("limit", "L", 30, "Maximum number of items to fetch")
28-
prListCmd.Flags().StringP("state", "s", "open", "Filter by state")
28+
prListCmd.Flags().StringP("state", "s", "open", "Filter by state: {open|closed|merged|all}")
2929
prListCmd.Flags().StringP("base", "B", "", "Filter by base branch")
3030
prListCmd.Flags().StringSliceP("label", "l", nil, "Filter by label")
3131
prListCmd.Flags().StringP("assignee", "a", "", "Filter by assignee")
@@ -34,10 +34,15 @@ func init() {
3434
var prCmd = &cobra.Command{
3535
Use: "pr",
3636
Short: "Create, view, and checkout pull requests",
37-
Long: `Work with GitHub pull requests.`,
37+
Long: `Work with GitHub pull requests.
38+
39+
A pull request can be supplied as argument in any of the following formats:
40+
- by number, e.g. "123";
41+
- by URL, e.g. "https://github.com/<owner>/<repo>/pull/123"; or
42+
- by the name of its head branch, e.g. "patch-1" or "<owner>:patch-1".`,
3843
}
3944
var prCheckoutCmd = &cobra.Command{
40-
Use: "checkout <pr-number>",
45+
Use: "checkout {<number> | <url> | <branch>}",
4146
Short: "Check out a pull request in Git",
4247
Args: cobra.MinimumNArgs(1),
4348
RunE: prCheckout,
@@ -53,7 +58,7 @@ var prStatusCmd = &cobra.Command{
5358
RunE: prStatus,
5459
}
5560
var prViewCmd = &cobra.Command{
56-
Use: "view [pr-number]",
61+
Use: "view {<number> | <url> | <branch>}",
5762
Short: "View a pull request in the browser",
5863
RunE: prView,
5964
}

0 commit comments

Comments
 (0)