diff options
-rw-r--r-- | commands/label add.go | 2 | ||||
-rw-r--r-- | doc/man/git-bug-label-add.1 | 29 | ||||
-rw-r--r-- | doc/man/git-bug-label.1 | 2 | ||||
-rw-r--r-- | doc/md/git-bug_label.md | 1 | ||||
-rw-r--r-- | doc/md/git-bug_label_add.md | 22 | ||||
-rw-r--r-- | misc/bash_completion/git-bug | 21 | ||||
-rw-r--r-- | misc/zsh_completion/git-bug | 3 | ||||
-rw-r--r-- | operations/label_change.go | 17 |
8 files changed, 95 insertions, 2 deletions
diff --git a/commands/label add.go b/commands/label add.go index 6eefa646..c7a37be8 100644 --- a/commands/label add.go +++ b/commands/label add.go @@ -46,5 +46,5 @@ var labelAddCmd = &cobra.Command{ } func init() { - // labelCmd.AddCommand(labelAddCmd) + labelCmd.AddCommand(labelAddCmd) } diff --git a/doc/man/git-bug-label-add.1 b/doc/man/git-bug-label-add.1 new file mode 100644 index 00000000..c3413126 --- /dev/null +++ b/doc/man/git-bug-label-add.1 @@ -0,0 +1,29 @@ +.TH "GIT-BUG" "1" "Sep 2018" "Generated from git-bug's source code" "" +.nh +.ad l + + +.SH NAME +.PP +git\-bug\-label\-add \- Add a label to a bug + + +.SH SYNOPSIS +.PP +\fBgit\-bug label add <id> [<label>\&...] [flags]\fP + + +.SH DESCRIPTION +.PP +Add a label to a bug + + +.SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP[=false] + help for add + + +.SH SEE ALSO +.PP +\fBgit\-bug\-label(1)\fP diff --git a/doc/man/git-bug-label.1 b/doc/man/git-bug-label.1 index 520551b8..235d7043 100644 --- a/doc/man/git-bug-label.1 +++ b/doc/man/git-bug-label.1 @@ -26,4 +26,4 @@ Display a bug labels .SH SEE ALSO .PP -\fBgit\-bug(1)\fP +\fBgit\-bug(1)\fP, \fBgit\-bug\-label\-add(1)\fP diff --git a/doc/md/git-bug_label.md b/doc/md/git-bug_label.md index bf100dbc..77960e15 100644 --- a/doc/md/git-bug_label.md +++ b/doc/md/git-bug_label.md @@ -19,4 +19,5 @@ git-bug label <id> [flags] ### SEE ALSO * [git-bug](git-bug.md) - A bugtracker embedded in Git +* [git-bug label add](git-bug_label_add.md) - Add a label to a bug diff --git a/doc/md/git-bug_label_add.md b/doc/md/git-bug_label_add.md new file mode 100644 index 00000000..a89a522c --- /dev/null +++ b/doc/md/git-bug_label_add.md @@ -0,0 +1,22 @@ +## git-bug label add + +Add a label to a bug + +### Synopsis + +Add a label to a bug + +``` +git-bug label add <id> [<label>...] [flags] +``` + +### Options + +``` + -h, --help help for add +``` + +### SEE ALSO + +* [git-bug label](git-bug_label.md) - Display a bug labels + diff --git a/misc/bash_completion/git-bug b/misc/bash_completion/git-bug index 3e1ba26f..7283ad2a 100644 --- a/misc/bash_completion/git-bug +++ b/misc/bash_completion/git-bug @@ -347,6 +347,26 @@ _git-bug_comment() noun_aliases=() } +_git-bug_label_add() +{ + last_command="git-bug_label_add" + + command_aliases=() + + commands=() + + flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + + + must_have_one_flag=() + must_have_one_noun=() + noun_aliases=() +} + _git-bug_label() { last_command="git-bug_label" @@ -354,6 +374,7 @@ _git-bug_label() command_aliases=() commands=() + commands+=("add") flags=() two_word_flags=() diff --git a/misc/zsh_completion/git-bug b/misc/zsh_completion/git-bug index bb22344a..b564942f 100644 --- a/misc/zsh_completion/git-bug +++ b/misc/zsh_completion/git-bug @@ -20,6 +20,9 @@ case $state in comment) _arguments '2: :(add)' ;; + label) + _arguments '2: :(add)' + ;; status) _arguments '2: :(close open)' ;; 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)) + } +} |