git-bug/commands/termui.go

32 lines
633 B
Go
Raw Normal View History

2018-07-30 18:00:10 +03:00
package commands
import (
"github.com/MichaelMure/git-bug/cache"
2018-07-30 18:00:10 +03:00
"github.com/MichaelMure/git-bug/termui"
"github.com/MichaelMure/git-bug/util/interrupt"
2018-07-30 18:00:10 +03:00
"github.com/spf13/cobra"
)
func runTermUI(cmd *cobra.Command, args []string) error {
backend, err := cache.NewRepoCache(repo)
if err != nil {
return err
}
defer backend.Close()
interrupt.RegisterCleaner(backend.Close)
return termui.Run(backend)
2018-07-30 18:00:10 +03:00
}
var termUICmd = &cobra.Command{
Use: "termui",
Aliases: []string{"tui"},
Short: "Launch the terminal UI.",
2019-02-23 15:01:46 +03:00
PreRunE: loadRepoEnsureUser,
RunE: runTermUI,
2018-07-30 18:00:10 +03:00
}
func init() {
RootCmd.AddCommand(termUICmd)
}