termui.go

 1package commands
 2
 3import (
 4	"github.com/MichaelMure/git-bug/cache"
 5	"github.com/MichaelMure/git-bug/termui"
 6	"github.com/spf13/cobra"
 7)
 8
 9func runTermUI(cmd *cobra.Command, args []string) error {
10	backend, err := cache.NewRepoCache(repo)
11	if err != nil {
12		return err
13	}
14	defer backend.Close()
15
16	return termui.Run(backend)
17}
18
19var termUICmd = &cobra.Command{
20	Use:     "termui",
21	Short:   "Launch the terminal UI",
22	PreRunE: loadRepo,
23	RunE:    runTermUI,
24}
25
26func init() {
27	RootCmd.AddCommand(termUICmd)
28}