aboutsummaryrefslogtreecommitdiffstats
path: root/commands/rm.go
diff options
context:
space:
mode:
authorvince <vincetiu8@gmail.com>2020-07-20 09:55:14 +0800
committerMichael Muré <batolettre@gmail.com>2020-07-28 14:30:05 +0200
commit4e4ca106aea25da74f1df49d33f4eaa272a6e8f0 (patch)
treea019a325fbafe1fe4ae5a834302eb6cd2e8a3f62 /commands/rm.go
parent36f300cb35b203310e923cf956310c7f20ed7406 (diff)
downloadgit-bug-4e4ca106aea25da74f1df49d33f4eaa272a6e8f0.tar.gz
Allow user to delete remote bugs
Diffstat (limited to 'commands/rm.go')
-rw-r--r--commands/rm.go22
1 files changed, 7 insertions, 15 deletions
diff --git a/commands/rm.go b/commands/rm.go
index 7b34a629..718fb4a3 100644
--- a/commands/rm.go
+++ b/commands/rm.go
@@ -1,25 +1,20 @@
package commands
import (
- "fmt"
-
"github.com/spf13/cobra"
)
-type rmOptions struct {
-}
-
func newRmCommand() *cobra.Command {
env := newEnv()
- options := rmOptions{}
cmd := &cobra.Command{
- Use: "rm <id>",
+ Use: "rm <id> [<remote>]",
Short: "Remove an existing bug.",
+ Long: "Remove an existing bug in the local repository. If the bug was imported from a bridge, specify the remote name to remove it from. Note removing bugs that were imported from bridges will not remove the bug remote, and will only remove the local copy of the bug.",
PreRunE: loadBackendEnsureUser(env),
PostRunE: closeBackend(env),
RunE: func(cmd *cobra.Command, args []string) error {
- return runRm(env, options, args)
+ return runRm(env, args)
},
}
@@ -29,17 +24,14 @@ func newRmCommand() *cobra.Command {
return cmd
}
-func runRm(env *Env, opts rmOptions, args []string) error {
- if len(args) == 0 {
- return fmt.Errorf("you must provide a bug id prefix to remove")
- }
+func runRm(env *Env, args []string) (err error) {
+ err = env.backend.RemoveBug(args)
- err := env.backend.RemoveBug(args[0])
if err != nil {
- return err
+ return
}
env.out.Printf("bug %s removed\n", args[0])
- return nil
+ return
}