aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorvince <vincetiu8@gmail.com>2020-07-24 11:25:38 +0800
committerMichael Muré <batolettre@gmail.com>2020-07-28 14:30:06 +0200
commit4e5f377d75824e31a058313cad2d2e478f348c28 (patch)
treecb2066a1b528a691589478a2260c1fbfbd681c96 /commands
parent9436cf4b8983699ef7a164f4036686dd83d345d4 (diff)
downloadgit-bug-4e5f377d75824e31a058313cad2d2e478f348c28.tar.gz
Remove need to specify remote
This commit makes the removeBug command use the listRefs repo command to search for the bug, eliminating the need to input the remote the bug came from.
Diffstat (limited to 'commands')
-rw-r--r--commands/rm.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/commands/rm.go b/commands/rm.go
index 800f16e1..90a79539 100644
--- a/commands/rm.go
+++ b/commands/rm.go
@@ -10,7 +10,7 @@ func newRmCommand() *cobra.Command {
env := newEnv()
cmd := &cobra.Command{
- Use: "rm <id> [<remote>]",
+ Use: "rm <id>",
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),
@@ -27,16 +27,12 @@ func newRmCommand() *cobra.Command {
}
func runRm(env *Env, args []string) (err error) {
- switch len(args) {
- case 1:
- err = env.backend.RemoveBug(args[0], "")
- break
- case 2:
- err = env.backend.RemoveBug(args[0], args[1])
- default:
- return errors.New("invalid number of arguments for rm command")
+ if len(args) == 0 {
+ return errors.New("you must provide a bug prefix to remove")
}
+ err = env.backend.RemoveBug(args[0])
+
if err != nil {
return
}