Skip to content

Commit

Permalink
mr: state that the MR ID parameter can be the branch name
Browse files Browse the repository at this point in the history
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 <aclopte@gmail.com>
  • Loading branch information
krobelus committed Oct 26, 2021
1 parent e6dca2d commit 4b03b4f
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cmd/mr_approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

var mrApproveCmd = &cobra.Command{
Use: "approve [remote] <id>",
Use: "approve [remote] [<MR id or branch>]",
Aliases: []string{},
Short: "Approve merge request",
Example: heredoc.Doc(`
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_browse.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

var mrBrowseCmd = &cobra.Command{
Use: "browse [remote] <id>",
Use: "browse [remote] [<MR id or branch>]",
Aliases: []string{"b"},
Short: "View merge request in a browser",
Example: "lab mr browse origin",
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (

// listCmd represents the list command
var checkoutCmd = &cobra.Command{
Use: "checkout [remote] <id>",
Use: "checkout [remote] [<MR id or branch>]",
Short: "Checkout an open merge request",
Args: cobra.RangeArgs(1, 2),
Example: heredoc.Doc(`
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_close.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var mrCloseCmd = &cobra.Command{
Use: "close [remote] <id>",
Use: "close [remote] [<MR id or branch>]",
Short: "Close merge request",
Example: "lab mr close origin 10",
PersistentPreRun: labPersistentPreRun,
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var mrDeleteCmd = &cobra.Command{
Use: "delete [remote] <id>",
Use: "delete [remote] [<MR id or branch>]",
Aliases: []string{"del"},
Short: "Delete a merge request on GitLab",
Long: heredoc.Doc(`
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_discussion.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

var mrCreateDiscussionCmd = &cobra.Command{
Use: "discussion [remote] <id>",
Use: "discussion [remote] [<MR ID or branch>]",
Short: "Start a discussion on an MR on GitLab",
Aliases: []string{"block", "thread"},
Example: heredoc.Doc(`
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
var mergeImmediate bool

var mrMergeCmd = &cobra.Command{
Use: "merge [remote] <id>",
Use: "merge [remote] [<MR id or branch>]",
Short: "Merge an open merge request",
Long: heredoc.Doc(`
Merges an open merge request. If the pipeline in the project is
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_rebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

var mrRebaseCmd = &cobra.Command{
Use: "rebase [remote] <id>",
Use: "rebase [remote] [<MR id or branch>]",
Short: "Rebase an open merge request",
Example: "lab mr rebase upstream 20",
PersistentPreRun: labPersistentPreRun,
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_reopen.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var mrReopenCmd = &cobra.Command{
Use: "reopen [remote] <id>",
Use: "reopen [remote] [<MR id or branch>]",
Short: "Reopen a closed merge request",
Example: "lab mr reopen upstream 20",
PersistentPreRun: labPersistentPreRun,
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
)

var mrShowCmd = &cobra.Command{
Use: "show [remote] <id>",
Use: "show [remote] [<MR id or branch>]",
Aliases: []string{"get"},
ArgAliases: []string{"s"},
Short: "Describe a merge request",
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

var mrSubscribeCmd = &cobra.Command{
Use: "subscribe [remote] <id>",
Use: "subscribe [remote] [<MR id or branch>]",
Aliases: []string{},
Short: "Subscribe to merge request",
Example: heredoc.Doc(`
Expand Down
4 changes: 2 additions & 2 deletions cmd/mr_thumb.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var mrThumbCmd = &cobra.Command{
}

var mrThumbUpCmd = &cobra.Command{
Use: "up [remote] <id>",
Use: "up [remote] [<MR id or branch>]",
Aliases: []string{},
Short: "Thumb up merge request",
Example: heredoc.Doc(`
Expand All @@ -45,7 +45,7 @@ var mrThumbUpCmd = &cobra.Command{
}

var mrThumbDownCmd = &cobra.Command{
Use: "down [remote] <id>",
Use: "down [remote] [<MR id or branch>]",
Aliases: []string{},
Short: "Thumbs down merge request",
Example: heredoc.Doc(`
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_unapprove.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

var mrUnapproveCmd = &cobra.Command{
Use: "unapprove [remote] <id>",
Use: "unapprove [remote] [<MR id or branch>]",
Aliases: []string{},
Short: "Unapprove merge request",
Example: heredoc.Doc(`
Expand Down
2 changes: 1 addition & 1 deletion cmd/mr_unsubscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

var mrUnsubscribeCmd = &cobra.Command{
Use: "unsubscribe [remote] <id>",
Use: "unsubscribe [remote] [<MR id or branch>]",
Aliases: []string{},
Short: "Unubscribe from merge request",
Example: heredoc.Doc(`
Expand Down

0 comments on commit 4b03b4f

Please sign in to comment.