From 4b03b4f90c448cf8a8706a0cfa1a7a8f91bb19db Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 9 Oct 2021 10:08:39 +0200 Subject: [PATCH] mr: state that the MR ID parameter can be the branch name The name of a MR's source branch can be used instead of the numeric MR id parameter on the command line. Advertise this in the command synopses. The branch name is easier to remember, and plays better with standard Git tooling than the opaque MR ids. While at it, add square brackets to mark that the MR id parameter is optional. If it's left out, we use the MR associated with the branch pointed to by HEAD. Signed-off-by: Johannes Altmanninger --- cmd/mr_approve.go | 2 +- cmd/mr_browse.go | 2 +- cmd/mr_checkout.go | 2 +- cmd/mr_close.go | 2 +- cmd/mr_delete.go | 2 +- cmd/mr_discussion.go | 2 +- cmd/mr_merge.go | 2 +- cmd/mr_rebase.go | 2 +- cmd/mr_reopen.go | 2 +- cmd/mr_show.go | 2 +- cmd/mr_subscribe.go | 2 +- cmd/mr_thumb.go | 4 ++-- cmd/mr_unapprove.go | 2 +- cmd/mr_unsubscribe.go | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cmd/mr_approve.go b/cmd/mr_approve.go index 17b8b6e5..cf1d9ce0 100644 --- a/cmd/mr_approve.go +++ b/cmd/mr_approve.go @@ -11,7 +11,7 @@ import ( ) var mrApproveCmd = &cobra.Command{ - Use: "approve [remote] ", + Use: "approve [remote] []", Aliases: []string{}, Short: "Approve merge request", Example: heredoc.Doc(` diff --git a/cmd/mr_browse.go b/cmd/mr_browse.go index 28de51e8..7a95403f 100644 --- a/cmd/mr_browse.go +++ b/cmd/mr_browse.go @@ -12,7 +12,7 @@ import ( ) var mrBrowseCmd = &cobra.Command{ - Use: "browse [remote] ", + Use: "browse [remote] []", Aliases: []string{"b"}, Short: "View merge request in a browser", Example: "lab mr browse origin", diff --git a/cmd/mr_checkout.go b/cmd/mr_checkout.go index ef4ba0c0..38333c16 100644 --- a/cmd/mr_checkout.go +++ b/cmd/mr_checkout.go @@ -27,7 +27,7 @@ var ( // listCmd represents the list command var checkoutCmd = &cobra.Command{ - Use: "checkout [remote] ", + Use: "checkout [remote] []", Short: "Checkout an open merge request", Args: cobra.RangeArgs(1, 2), Example: heredoc.Doc(` diff --git a/cmd/mr_close.go b/cmd/mr_close.go index 0e0c2205..76978ebc 100644 --- a/cmd/mr_close.go +++ b/cmd/mr_close.go @@ -10,7 +10,7 @@ import ( ) var mrCloseCmd = &cobra.Command{ - Use: "close [remote] ", + Use: "close [remote] []", Short: "Close merge request", Example: "lab mr close origin 10", PersistentPreRun: labPersistentPreRun, diff --git a/cmd/mr_delete.go b/cmd/mr_delete.go index e52e05ad..a8c194a0 100644 --- a/cmd/mr_delete.go +++ b/cmd/mr_delete.go @@ -9,7 +9,7 @@ import ( ) var mrDeleteCmd = &cobra.Command{ - Use: "delete [remote] ", + Use: "delete [remote] []", Aliases: []string{"del"}, Short: "Delete a merge request on GitLab", Long: heredoc.Doc(` diff --git a/cmd/mr_discussion.go b/cmd/mr_discussion.go index 09c245b3..9c63a693 100644 --- a/cmd/mr_discussion.go +++ b/cmd/mr_discussion.go @@ -17,7 +17,7 @@ import ( ) var mrCreateDiscussionCmd = &cobra.Command{ - Use: "discussion [remote] ", + Use: "discussion [remote] []", Short: "Start a discussion on an MR on GitLab", Aliases: []string{"block", "thread"}, Example: heredoc.Doc(` diff --git a/cmd/mr_merge.go b/cmd/mr_merge.go index 4860b5a4..002412d3 100644 --- a/cmd/mr_merge.go +++ b/cmd/mr_merge.go @@ -14,7 +14,7 @@ import ( var mergeImmediate bool var mrMergeCmd = &cobra.Command{ - Use: "merge [remote] ", + Use: "merge [remote] []", Short: "Merge an open merge request", Long: heredoc.Doc(` Merges an open merge request. If the pipeline in the project is diff --git a/cmd/mr_rebase.go b/cmd/mr_rebase.go index b5aff23b..a69ccf65 100644 --- a/cmd/mr_rebase.go +++ b/cmd/mr_rebase.go @@ -8,7 +8,7 @@ import ( ) var mrRebaseCmd = &cobra.Command{ - Use: "rebase [remote] ", + Use: "rebase [remote] []", Short: "Rebase an open merge request", Example: "lab mr rebase upstream 20", PersistentPreRun: labPersistentPreRun, diff --git a/cmd/mr_reopen.go b/cmd/mr_reopen.go index 1cd7d618..029b9b77 100644 --- a/cmd/mr_reopen.go +++ b/cmd/mr_reopen.go @@ -10,7 +10,7 @@ import ( ) var mrReopenCmd = &cobra.Command{ - Use: "reopen [remote] ", + Use: "reopen [remote] []", Short: "Reopen a closed merge request", Example: "lab mr reopen upstream 20", PersistentPreRun: labPersistentPreRun, diff --git a/cmd/mr_show.go b/cmd/mr_show.go index 73dae68d..6ef9c615 100644 --- a/cmd/mr_show.go +++ b/cmd/mr_show.go @@ -21,7 +21,7 @@ var ( ) var mrShowCmd = &cobra.Command{ - Use: "show [remote] ", + Use: "show [remote] []", Aliases: []string{"get"}, ArgAliases: []string{"s"}, Short: "Describe a merge request", diff --git a/cmd/mr_subscribe.go b/cmd/mr_subscribe.go index c4b5ce23..df080736 100644 --- a/cmd/mr_subscribe.go +++ b/cmd/mr_subscribe.go @@ -11,7 +11,7 @@ import ( ) var mrSubscribeCmd = &cobra.Command{ - Use: "subscribe [remote] ", + Use: "subscribe [remote] []", Aliases: []string{}, Short: "Subscribe to merge request", Example: heredoc.Doc(` diff --git a/cmd/mr_thumb.go b/cmd/mr_thumb.go index cec7e8a0..f233f1ad 100644 --- a/cmd/mr_thumb.go +++ b/cmd/mr_thumb.go @@ -18,7 +18,7 @@ var mrThumbCmd = &cobra.Command{ } var mrThumbUpCmd = &cobra.Command{ - Use: "up [remote] ", + Use: "up [remote] []", Aliases: []string{}, Short: "Thumb up merge request", Example: heredoc.Doc(` @@ -45,7 +45,7 @@ var mrThumbUpCmd = &cobra.Command{ } var mrThumbDownCmd = &cobra.Command{ - Use: "down [remote] ", + Use: "down [remote] []", Aliases: []string{}, Short: "Thumbs down merge request", Example: heredoc.Doc(` diff --git a/cmd/mr_unapprove.go b/cmd/mr_unapprove.go index ae100537..ff913c33 100644 --- a/cmd/mr_unapprove.go +++ b/cmd/mr_unapprove.go @@ -12,7 +12,7 @@ import ( ) var mrUnapproveCmd = &cobra.Command{ - Use: "unapprove [remote] ", + Use: "unapprove [remote] []", Aliases: []string{}, Short: "Unapprove merge request", Example: heredoc.Doc(` diff --git a/cmd/mr_unsubscribe.go b/cmd/mr_unsubscribe.go index 67a87223..136e52a3 100644 --- a/cmd/mr_unsubscribe.go +++ b/cmd/mr_unsubscribe.go @@ -11,7 +11,7 @@ import ( ) var mrUnsubscribeCmd = &cobra.Command{ - Use: "unsubscribe [remote] ", + Use: "unsubscribe [remote] []", Aliases: []string{}, Short: "Unubscribe from merge request", Example: heredoc.Doc(`