1package commands
2
3import (
4 "fmt"
5
6 "github.com/MichaelMure/git-bug/cache"
7 "github.com/MichaelMure/git-bug/commands/select"
8 "github.com/spf13/cobra"
9)
10
11func runStatus(cmd *cobra.Command, args []string) error {
12 backend, err := cache.NewRepoCache(repo)
13 if err != nil {
14 return err
15 }
16 defer backend.Close()
17
18 b, args, err := _select.ResolveBug(backend, args)
19 if err != nil {
20 return err
21 }
22
23 snap := b.Snapshot()
24
25 fmt.Println(snap.Status)
26
27 return nil
28}
29
30var statusCmd = &cobra.Command{
31 Use: "status [<id>]",
32 Short: "Display or change a bug status",
33 PreRunE: loadRepo,
34 RunE: runStatus,
35}
36
37func init() {
38 RootCmd.AddCommand(statusCmd)
39}