mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-05 12:41:32 +02:00
Correct naming of parameter: set/add/remove are actions.
'command' is not approprirate for the set/add/remove operations, and is confusing. Rename to 'action' to remove this confusion.
This commit is contained in:
+12
-12
@@ -542,11 +542,11 @@ func (c *Cli) CmdComment(issue string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cli) CmdLabels(command string, issue string, labels []string) error {
|
func (c *Cli) CmdLabels(action string, issue string, labels []string) error {
|
||||||
log.Debug("label called")
|
log.Debug("label called")
|
||||||
|
|
||||||
if command != "add" && command != "remove" && command != "set" {
|
if action != "add" && action != "remove" && action != "set" {
|
||||||
return fmt.Errorf("command must be 'add', 'set' or 'remove': %q is invalid", command)
|
return fmt.Errorf("action must be 'add', 'set' or 'remove': %q is invalid", action)
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePut := func(json string) error {
|
handlePut := func(json string) error {
|
||||||
@@ -579,24 +579,24 @@ func (c *Cli) CmdLabels(command string, issue string, labels []string) error {
|
|||||||
|
|
||||||
var labels_json string
|
var labels_json string
|
||||||
var err error
|
var err error
|
||||||
if command == "set" {
|
if action == "set" {
|
||||||
labelsCommands := make([]map[string][]string, 1)
|
labelsActions := make([]map[string][]string, 1)
|
||||||
labelsCommands[0] = map[string][]string{
|
labelsActions[0] = map[string][]string{
|
||||||
"set": labels,
|
"set": labels,
|
||||||
}
|
}
|
||||||
labels_json, err = jsonEncode(map[string]interface{}{
|
labels_json, err = jsonEncode(map[string]interface{}{
|
||||||
"labels": labelsCommands,
|
"labels": labelsActions,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
labelsCommands := make([]map[string]string, len(labels))
|
labelsActions := make([]map[string]string, len(labels))
|
||||||
for i, label := range labels {
|
for i, label := range labels {
|
||||||
labelCommandMap := map[string]string{
|
labelActionMap := map[string]string{
|
||||||
command: label,
|
action: label,
|
||||||
}
|
}
|
||||||
labelsCommands[i] = labelCommandMap
|
labelsActions[i] = labelActionMap
|
||||||
}
|
}
|
||||||
labels_json, err = jsonEncode(map[string]interface{}{
|
labels_json, err = jsonEncode(map[string]interface{}{
|
||||||
"labels": labelsCommands,
|
"labels": labelsActions,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user