Skip to content

Commit

Permalink
parse #ids, added docs
Browse files Browse the repository at this point in the history
  • Loading branch information
craftamap committed Dec 14, 2020
1 parent 568920c commit caf5ce3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions cmd/commands/pr/merge/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package merge
import (
"fmt"
"strconv"
"strings"

"github.com/cli/cli/git"
"github.com/craftamap/bb/cmd/commands/pr/view"
Expand All @@ -13,7 +14,7 @@ import (

func Add(prCmd *cobra.Command, globalOpts *options.GlobalOptions) {
mergeCmd := &cobra.Command{
Use: "merge",
Use: "merge <number of pr>",
Long: "Merge a pull request on Bitbucket.org",
Short: "Merge a pull request",
Annotations: map[string]string{
Expand All @@ -28,7 +29,7 @@ func Add(prCmd *cobra.Command, globalOpts *options.GlobalOptions) {
bbrepo := globalOpts.BitbucketRepo

if len(args) > 0 {
id, err = strconv.Atoi(args[0])
id, err = strconv.Atoi(strings.TrimPrefix(args[0], "#"))
if err != nil {
fmt.Printf("%s%s%s\n", aurora.Red(":: "), aurora.Bold("An error occurred: "), err)
return
Expand Down
5 changes: 3 additions & 2 deletions cmd/commands/pr/statuses/statuses.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package statuses
import (
"fmt"
"strconv"
"strings"

"github.com/cli/cli/git"
"github.com/craftamap/bb/cmd/options"
Expand All @@ -19,7 +20,7 @@ const (

func Add(prCmd *cobra.Command, globalOpts *options.GlobalOptions) {
statusesCmd := &cobra.Command{
Use: "statuses",
Use: "statuses <number of pr>",
Short: "Show CI status for a single pull request",
Long: "Show CI status for a single pull request",
Annotations: map[string]string{
Expand All @@ -34,7 +35,7 @@ func Add(prCmd *cobra.Command, globalOpts *options.GlobalOptions) {
bbrepo := globalOpts.BitbucketRepo

if len(args) > 0 {
id, err = strconv.Atoi(args[0])
id, err = strconv.Atoi(strings.TrimPrefix(args[0], "#"))
if err != nil {
fmt.Printf("%s%s%s\n", aurora.Red(":: "), aurora.Bold("An error occurred: "), err)
return
Expand Down
5 changes: 3 additions & 2 deletions cmd/commands/pr/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package view
import (
"fmt"
"strconv"
"strings"

"github.com/charmbracelet/glamour"
"github.com/cli/cli/git"
Expand All @@ -19,7 +20,7 @@ var (

func Add(prCmd *cobra.Command, globalOpts *options.GlobalOptions) {
viewCmd := &cobra.Command{
Use: "view",
Use: "view <nr of pr>",
Short: "View a pull request",
Long: "Display the title, body, and other information about a pull request.",
Annotations: map[string]string{
Expand All @@ -34,7 +35,7 @@ func Add(prCmd *cobra.Command, globalOpts *options.GlobalOptions) {
bbrepo := globalOpts.BitbucketRepo

if len(args) > 0 {
id, err = strconv.Atoi(args[0])
id, err = strconv.Atoi(strings.TrimPrefix(args[0], "#"))
if err != nil {
fmt.Printf("%s%s%s\n", aurora.Red(":: "), aurora.Bold("An error occurred: "), err)
return
Expand Down

0 comments on commit caf5ce3

Please # to comment.