From 8a0d5b0e43cef52d64e6dd2c5c6cbb4238cebe77 Mon Sep 17 00:00:00 2001 From: Cristian Dominguez Date: Tue, 13 Apr 2021 12:30:07 -0300 Subject: [PATCH] Add note about current branch detection --- pkg/cmd/pr/checks/checks.go | 9 ++++++++- pkg/cmd/pr/comment/comment.go | 8 ++++++++ pkg/cmd/pr/diff/diff.go | 9 ++++++++- pkg/cmd/pr/edit/edit.go | 6 ++++++ pkg/cmd/pr/merge/merge.go | 3 +++ pkg/cmd/pr/ready/ready.go | 9 ++++++++- 6 files changed, 41 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/pr/checks/checks.go b/pkg/cmd/pr/checks/checks.go index 515c9b0b5..1a11f3d44 100644 --- a/pkg/cmd/pr/checks/checks.go +++ b/pkg/cmd/pr/checks/checks.go @@ -7,6 +7,7 @@ import ( "sort" "time" + "github.com/MakeNowJust/heredoc" "github.com/cli/cli/api" "github.com/cli/cli/context" "github.com/cli/cli/internal/ghrepo" @@ -47,7 +48,13 @@ func NewCmdChecks(f *cmdutil.Factory, runF func(*ChecksOptions) error) *cobra.Co cmd := &cobra.Command{ Use: "checks [ | | ]", Short: "Show CI status for a single pull request", - Args: cobra.MaximumNArgs(1), + Long: heredoc.Doc(` + Show CI status for a single pull request. + + Without an argument, the pull request that belongs to the current branch + is selected. + `), + Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { // support `-R, --repo` override opts.BaseRepo = f.BaseRepo diff --git a/pkg/cmd/pr/comment/comment.go b/pkg/cmd/pr/comment/comment.go index b993fd407..a9ec5e9d3 100644 --- a/pkg/cmd/pr/comment/comment.go +++ b/pkg/cmd/pr/comment/comment.go @@ -28,6 +28,14 @@ func NewCmdComment(f *cmdutil.Factory, runF func(*shared.CommentableOptions) err cmd := &cobra.Command{ Use: "comment [ | | ]", Short: "Create a new pr comment", + Long: heredoc.Doc(` + Create a new pr comment. + + Without an argument, the pull request that belongs to the current branch + is selected. + + With '--web', comment on the pull request in a web browser instead. + `), Example: heredoc.Doc(` $ gh pr comment 22 --body "This looks great, lets get it deployed." `), diff --git a/pkg/cmd/pr/diff/diff.go b/pkg/cmd/pr/diff/diff.go index 2bea8072b..00a41c657 100644 --- a/pkg/cmd/pr/diff/diff.go +++ b/pkg/cmd/pr/diff/diff.go @@ -9,6 +9,7 @@ import ( "strings" "syscall" + "github.com/MakeNowJust/heredoc" "github.com/cli/cli/api" "github.com/cli/cli/context" "github.com/cli/cli/internal/ghrepo" @@ -40,7 +41,13 @@ func NewCmdDiff(f *cmdutil.Factory, runF func(*DiffOptions) error) *cobra.Comman cmd := &cobra.Command{ Use: "diff [ | | ]", Short: "View changes in a pull request", - Args: cobra.MaximumNArgs(1), + Long: heredoc.Doc(` + View changes in a pull request. + + Without an argument, the pull request that belongs to the current branch + is selected. + `), + Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { // support `-R, --repo` override opts.BaseRepo = f.BaseRepo diff --git a/pkg/cmd/pr/edit/edit.go b/pkg/cmd/pr/edit/edit.go index 7a01f5125..dbf0321f9 100644 --- a/pkg/cmd/pr/edit/edit.go +++ b/pkg/cmd/pr/edit/edit.go @@ -50,6 +50,12 @@ func NewCmdEdit(f *cmdutil.Factory, runF func(*EditOptions) error) *cobra.Comman cmd := &cobra.Command{ Use: "edit [ | | ]", Short: "Edit a pull request", + Long: heredoc.Doc(` + Edit a pull request. + + Without an argument, the pull request that belongs to the current branch + is selected. + `), Example: heredoc.Doc(` $ gh pr edit 23 --title "I found a bug" --body "Nothing works" $ gh pr edit 23 --add-label "bug,help wanted" --remove-label "core" diff --git a/pkg/cmd/pr/merge/merge.go b/pkg/cmd/pr/merge/merge.go index 96fb2b7f6..31a91d6be 100644 --- a/pkg/cmd/pr/merge/merge.go +++ b/pkg/cmd/pr/merge/merge.go @@ -70,6 +70,9 @@ func NewCmdMerge(f *cmdutil.Factory, runF func(*MergeOptions) error) *cobra.Comm Short: "Merge a pull request", Long: heredoc.Doc(` Merge a pull request on GitHub. + + Without an argument, the pull request that belongs to the current branch + is selected. `), Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/pkg/cmd/pr/ready/ready.go b/pkg/cmd/pr/ready/ready.go index 003902963..f21a48d45 100644 --- a/pkg/cmd/pr/ready/ready.go +++ b/pkg/cmd/pr/ready/ready.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" + "github.com/MakeNowJust/heredoc" "github.com/cli/cli/api" "github.com/cli/cli/context" "github.com/cli/cli/internal/config" @@ -38,7 +39,13 @@ func NewCmdReady(f *cmdutil.Factory, runF func(*ReadyOptions) error) *cobra.Comm cmd := &cobra.Command{ Use: "ready [ | | ]", Short: "Mark a pull request as ready for review", - Args: cobra.MaximumNArgs(1), + Long: heredoc.Doc(` + Mark a pull request as ready for review + + Without an argument, the pull request that belongs to the current branch + is displayed. + `), + Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { // support `-R, --repo` override opts.BaseRepo = f.BaseRepo