mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-19 12:43:30 +02:00
Tweak CmdLabels args so that magic happens with CLI
The CLI looks for commands (like 'labels') in the first two positional args. This is how commands like 'BLOCKER blocks ISSUE' work. As per @coryb's comments in #21 - this allows us to support set/add/remove in a consistent way for other types: components for example. This commit rearranges the command to be as follows: jira (set/add/remove) labels ISSUE LABELS... The options to CmdLabels have been reordered accordingly.
This commit is contained in:
+1
-1
@@ -542,7 +542,7 @@ func (c *Cli) CmdComment(issue string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cli) CmdLabels(issue string, command string, labels []string) error {
|
||||
func (c *Cli) CmdLabels(command string, issue string, labels []string) error {
|
||||
log.Debug("label called")
|
||||
|
||||
if command != "add" && command != "remove" && command != "set" {
|
||||
|
||||
+6
-2
@@ -65,7 +65,7 @@ Usage:
|
||||
jira start ISSUE [--edit] <Edit Options>
|
||||
jira stop ISSUE [--edit] <Edit Options>
|
||||
jira comment ISSUE [--noedit] <Edit Options>
|
||||
jira labels ISSUE set,add,remove [LABEL] ...
|
||||
jira (set,add,remove) labels ISSUE [LABEL] ...
|
||||
jira take ISSUE
|
||||
jira (assign|give) ISSUE ASSIGNEE
|
||||
jira fields
|
||||
@@ -219,6 +219,7 @@ Command Options:
|
||||
args = args[1:]
|
||||
} else if len(args) > 1 {
|
||||
// look at second arg for "dups" and "blocks" commands
|
||||
// also for 'set/add/remove' actions like 'labels'
|
||||
if alias, ok := jiraCommands[args[1]]; ok {
|
||||
command = alias
|
||||
args = append(args[:1], args[2:]...)
|
||||
@@ -382,7 +383,10 @@ Command Options:
|
||||
err = c.CmdComment(args[0])
|
||||
case "labels":
|
||||
requireArgs(2)
|
||||
err = c.CmdLabels(args[0], args[1], args[2:])
|
||||
action := args[0]
|
||||
issue := args[1]
|
||||
labels := args[2:]
|
||||
err = c.CmdLabels(action, issue, labels)
|
||||
case "take":
|
||||
requireArgs(1)
|
||||
err = c.CmdAssign(args[0], opts["user"].(string))
|
||||
|
||||
Reference in New Issue
Block a user