From 5ec01101c9671e59d72089ee2fc65e8ffccd879e Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Tue, 13 Jul 2021 19:38:01 +0900 Subject: [PATCH] feat mr: remove prefix in ID of MR just like Issue This change - improves consistency of APIs. - is copied from: https://github.com/profclems/glab/blob/0232a0c0791374ef5c1fa2072582a7127126b078/commands/issue/issueutils/utils.go#L106 - makes pipes easier - e.g., `glab mr list | fzf | grep -oE "^\S+" | glab mr view` - this is what atusy/ghf internally does Finishes #789 --- commands/mr/mrutils/mrutils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/mr/mrutils/mrutils.go b/commands/mr/mrutils/mrutils.go index 06af4acc..0ca09cc5 100644 --- a/commands/mr/mrutils/mrutils.go +++ b/commands/mr/mrutils/mrutils.go @@ -142,7 +142,7 @@ func MRFromArgsWithOpts( var branch string if len(args) > 0 { - mrID, err = strconv.Atoi(args[0]) + mrID, err = strconv.Atoi(strings.TrimPrefix(args[0], "!")) if err != nil { branch = args[0] } else if mrID == 0 { // to check for cases where the user explicitly specified mrID to be zero