aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/label add.go7
-rw-r--r--commands/label rm.go51
-rw-r--r--doc/man/git-bug-label-rm.129
-rw-r--r--doc/man/git-bug-label.12
-rw-r--r--doc/md/git-bug_label.md1
-rw-r--r--doc/md/git-bug_label_rm.md22
-rw-r--r--misc/bash_completion/git-bug21
-rw-r--r--misc/zsh_completion/git-bug2
8 files changed, 130 insertions, 5 deletions
diff --git a/commands/label add.go b/commands/label add.go
index c7a37be8..fccbfaa3 100644
--- a/commands/label add.go
+++ b/commands/label add.go
@@ -28,14 +28,15 @@ func runLabelAdd(cmd *cobra.Command, args []string) error {
}
changes, err := b.ChangeLabels(add, nil)
- if err != nil {
- return err
- }
for _, change := range changes {
fmt.Println(change)
}
+ if err != nil {
+ return err
+ }
+
return b.Commit()
}
diff --git a/commands/label rm.go b/commands/label rm.go
new file mode 100644
index 00000000..9908094c
--- /dev/null
+++ b/commands/label rm.go
@@ -0,0 +1,51 @@
+package commands
+
+import (
+ "errors"
+ "fmt"
+
+ "github.com/MichaelMure/git-bug/cache"
+ "github.com/spf13/cobra"
+)
+
+func runLabelRm(cmd *cobra.Command, args []string) error {
+ if len(args) == 0 {
+ return errors.New("You must provide a bug id")
+ }
+
+ backend, err := cache.NewRepoCache(repo)
+ if err != nil {
+ return err
+ }
+ defer backend.Close()
+
+ prefix := args[0]
+ remove := args[1:]
+
+ b, err := backend.ResolveBugPrefix(prefix)
+ if err != nil {
+ return err
+ }
+
+ changes, err := b.ChangeLabels(nil, remove)
+
+ for _, change := range changes {
+ fmt.Println(change)
+ }
+
+ if err != nil {
+ return err
+ }
+
+ return b.Commit()
+}
+
+var labelRmCmd = &cobra.Command{
+ Use: "rm <id> [<label>...]",
+ Short: "Remove a label from a bug",
+ RunE: runLabelRm,
+}
+
+func init() {
+ labelCmd.AddCommand(labelRmCmd)
+}
diff --git a/doc/man/git-bug-label-rm.1 b/doc/man/git-bug-label-rm.1
new file mode 100644
index 00000000..c7f308ed
--- /dev/null
+++ b/doc/man/git-bug-label-rm.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\-rm \- Remove a label from a bug
+
+
+.SH SYNOPSIS
+.PP
+\fBgit\-bug label rm <id> [<label>\&...] [flags]\fP
+
+
+.SH DESCRIPTION
+.PP
+Remove a label from a bug
+
+
+.SH OPTIONS
+.PP
+\fB\-h\fP, \fB\-\-help\fP[=false]
+ help for rm
+
+
+.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 235d7043..6621b7a7 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\-label\-add(1)\fP
+\fBgit\-bug(1)\fP, \fBgit\-bug\-label\-add(1)\fP, \fBgit\-bug\-label\-rm(1)\fP
diff --git a/doc/md/git-bug_label.md b/doc/md/git-bug_label.md
index 77960e15..75f4b843 100644
--- a/doc/md/git-bug_label.md
+++ b/doc/md/git-bug_label.md
@@ -20,4 +20,5 @@ git-bug label <id> [flags]
* [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
+* [git-bug label rm](git-bug_label_rm.md) - Remove a label from a bug
diff --git a/doc/md/git-bug_label_rm.md b/doc/md/git-bug_label_rm.md
new file mode 100644
index 00000000..3c740a9f
--- /dev/null
+++ b/doc/md/git-bug_label_rm.md
@@ -0,0 +1,22 @@
+## git-bug label rm
+
+Remove a label from a bug
+
+### Synopsis
+
+Remove a label from a bug
+
+```
+git-bug label rm <id> [<label>...] [flags]
+```
+
+### Options
+
+```
+ -h, --help help for rm
+```
+
+### 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 7283ad2a..d0613dc7 100644
--- a/misc/bash_completion/git-bug
+++ b/misc/bash_completion/git-bug
@@ -367,6 +367,26 @@ _git-bug_label_add()
noun_aliases=()
}
+_git-bug_label_rm()
+{
+ last_command="git-bug_label_rm"
+
+ 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"
@@ -375,6 +395,7 @@ _git-bug_label()
commands=()
commands+=("add")
+ commands+=("rm")
flags=()
two_word_flags=()
diff --git a/misc/zsh_completion/git-bug b/misc/zsh_completion/git-bug
index b564942f..35506b76 100644
--- a/misc/zsh_completion/git-bug
+++ b/misc/zsh_completion/git-bug
@@ -21,7 +21,7 @@ case $state in
_arguments '2: :(add)'
;;
label)
- _arguments '2: :(add)'
+ _arguments '2: :(add rm)'
;;
status)
_arguments '2: :(close open)'