aboutsummaryrefslogtreecommitdiffstats
path: root/operations/label_change.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-17 14:33:34 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-17 14:33:34 +0200
commit2965b70f4f462b3532bb380c5206e2d940f68c65 (patch)
treef612b5406f2173b981f54c1dfb12c45e1203dea1 /operations/label_change.go
parentcc086ebae99dfeb936d9397f4e3eedf5d37a97b1 (diff)
downloadgit-bug-2965b70f4f462b3532bb380c5206e2d940f68c65.tar.gz
commands: add a "label add" command to add new label to a bug
Diffstat (limited to 'operations/label_change.go')
-rw-r--r--operations/label_change.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/operations/label_change.go b/operations/label_change.go
index 507651df..0ae4e032 100644
--- a/operations/label_change.go
+++ b/operations/label_change.go
@@ -167,3 +167,20 @@ type LabelChangeResult struct {
Label bug.Label
Status LabelChangeStatus
}
+
+func (l LabelChangeResult) String() string {
+ switch l.Status {
+ case LabelChangeAdded:
+ return fmt.Sprintf("label %s added", l.Label)
+ case LabelChangeRemoved:
+ return fmt.Sprintf("label %s removed", l.Label)
+ case LabelChangeDuplicateInOp:
+ return fmt.Sprintf("label %s is a duplicate", l.Label)
+ case LabelChangeAlreadySet:
+ return fmt.Sprintf("label %s was already set", l.Label)
+ case LabelChangeDoesntExist:
+ return fmt.Sprintf("label %s doesn't exist on this bug", l.Label)
+ default:
+ panic(fmt.Sprintf("unknown label change status %v", l.Status))
+ }
+}