git-bug/commands/termui.go

29 lines
580 B
Go
Raw Normal View History

2018-07-30 18:00:10 +03:00
package commands
import (
2020-06-28 19:26:29 +03:00
"github.com/spf13/cobra"
"github.com/MichaelMure/git-bug/commands/execenv"
2018-07-30 18:00:10 +03:00
"github.com/MichaelMure/git-bug/termui"
)
2020-06-28 19:26:29 +03:00
func newTermUICommand() *cobra.Command {
env := execenv.NewEnv()
2020-06-28 19:26:29 +03:00
cmd := &cobra.Command{
Use: "termui",
Aliases: []string{"tui"},
Short: "Launch the terminal UI",
PreRunE: execenv.LoadBackendEnsureUser(env),
RunE: execenv.CloseBackend(env, func(cmd *cobra.Command, args []string) error {
2020-06-28 19:26:29 +03:00
return runTermUI(env)
}),
2020-06-28 19:26:29 +03:00
}
return cmd
}
func runTermUI(env *execenv.Env) error {
return termui.Run(env.Backend)
2018-07-30 18:00:10 +03:00
}