Skip to content

Commit

Permalink
make jira ISSUE-123 usage call jira view ISSUE-123
Browse files Browse the repository at this point in the history
  • Loading branch information
coryb committed Aug 31, 2017
1 parent 301a61f commit ec0858b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/jira/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"net/http"
"os"
"path/filepath"
"regexp"
"runtime/debug"

"github.com/coryb/figtree"
Expand Down Expand Up @@ -305,6 +306,15 @@ func main() {
}
panic(jiracli.Exit{Code: 1})
})
if len(os.Args) > 1 {
// if first arg matches ISSUE-123 pattern then we assume it is a 'view' operation
if ok, err := regexp.MatchString("^[A-Z]+-[0-9]+$", os.Args[1]); err != nil {
log.Errorf("Invalid Regex: %s", err)
} else if ok {
// insert "view" at i=1 (2nd position)
os.Args = append(os.Args[:1], append([]string{"view"}, os.Args[1:]...)...)
}
}
if _, err := app.Parse(os.Args[1:]); err != nil {
ctx, _ := app.ParseContext(os.Args[1:])
if ctx != nil {
Expand Down

0 comments on commit ec0858b

Please sign in to comment.