2018-07-17 20:28:37 +03:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2018-08-31 14:18:03 +03:00
|
|
|
"github.com/MichaelMure/git-bug/cache"
|
2018-09-18 14:28:01 +03:00
|
|
|
"github.com/MichaelMure/git-bug/commands/select"
|
2018-07-19 13:30:25 +03:00
|
|
|
"github.com/spf13/cobra"
|
2018-07-17 20:28:37 +03:00
|
|
|
)
|
|
|
|
|
2018-09-16 15:29:14 +03:00
|
|
|
func runStatusOpen(cmd *cobra.Command, args []string) error {
|
2018-08-31 14:18:03 +03:00
|
|
|
backend, err := cache.NewRepoCache(repo)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
defer backend.Close()
|
|
|
|
|
2018-09-18 14:28:01 +03:00
|
|
|
b, args, err := _select.ResolveBug(backend, args)
|
2018-07-17 20:28:37 +03:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2018-08-31 14:18:03 +03:00
|
|
|
err = b.Open()
|
2018-07-18 01:16:06 +03:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2018-08-31 14:18:03 +03:00
|
|
|
return b.Commit()
|
2018-07-17 20:28:37 +03:00
|
|
|
}
|
|
|
|
|
2018-07-19 13:30:25 +03:00
|
|
|
var openCmd = &cobra.Command{
|
2018-09-18 14:28:01 +03:00
|
|
|
Use: "open [<id>]",
|
2018-09-21 14:37:22 +03:00
|
|
|
Short: "Mark a bug as open",
|
2018-09-16 15:29:14 +03:00
|
|
|
RunE: runStatusOpen,
|
2018-07-19 13:30:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2018-09-16 15:29:14 +03:00
|
|
|
statusCmd.AddCommand(openCmd)
|
2018-07-17 20:28:37 +03:00
|
|
|
}
|