aboutsummaryrefslogtreecommitdiffstats
path: root/commands/label rm.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/label rm.go')
-rw-r--r--commands/label rm.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/commands/label rm.go b/commands/label rm.go
index 9908094c..8ad89593 100644
--- a/commands/label rm.go
+++ b/commands/label rm.go
@@ -1,33 +1,26 @@
package commands
import (
- "errors"
"fmt"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/commands/select"
"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)
+ b, args, err := _select.ResolveBug(backend, args)
if err != nil {
return err
}
- changes, err := b.ChangeLabels(nil, remove)
+ changes, err := b.ChangeLabels(nil, args)
for _, change := range changes {
fmt.Println(change)
@@ -41,7 +34,7 @@ func runLabelRm(cmd *cobra.Command, args []string) error {
}
var labelRmCmd = &cobra.Command{
- Use: "rm <id> [<label>...]",
+ Use: "rm [<id>] <label>[...]",
Short: "Remove a label from a bug",
RunE: runLabelRm,
}