1package bugcmd
2
3import (
4 "github.com/spf13/cobra"
5
6 "github.com/MichaelMure/git-bug/commands/bug/select"
7 "github.com/MichaelMure/git-bug/commands/execenv"
8)
9
10func newBugDeselectCommand() *cobra.Command {
11 env := execenv.NewEnv()
12
13 cmd := &cobra.Command{
14 Use: "deselect",
15 Short: "Clear the implicitly selected bug",
16 Example: `git bug select 2f15
17git bug comment
18git bug status
19git bug deselect
20`,
21 PreRunE: execenv.LoadBackend(env),
22 RunE: execenv.CloseBackend(env, func(cmd *cobra.Command, args []string) error {
23 return runBugDeselect(env)
24 }),
25 }
26
27 return cmd
28}
29
30func runBugDeselect(env *execenv.Env) error {
31 err := _select.Clear(env.Backend)
32 if err != nil {
33 return err
34 }
35
36 return nil
37}