1package commands
2
3import (
4 "github.com/spf13/cobra"
5
6 "github.com/MichaelMure/git-bug/termui"
7)
8
9func newTermUICommand() *cobra.Command {
10 env := newEnv()
11
12 cmd := &cobra.Command{
13 Use: "termui",
14 Aliases: []string{"tui"},
15 Short: "Launch the terminal UI.",
16 PreRunE: loadBackendEnsureUser(env),
17 PostRunE: closeBackend(env),
18 RunE: func(cmd *cobra.Command, args []string) error {
19 return runTermUI(env)
20 },
21 }
22
23 return cmd
24}
25
26func runTermUI(env *Env) error {
27 return termui.Run(env.backend)
28}