2018-07-30 18:00:10 +03:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2020-06-28 19:26:29 +03:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
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 := newEnv()
|
|
|
|
|
|
|
|
cmd := &cobra.Command{
|
2021-05-09 12:33:20 +03:00
|
|
|
Use: "termui",
|
|
|
|
Aliases: []string{"tui"},
|
|
|
|
Short: "Launch the terminal UI.",
|
|
|
|
PreRunE: loadBackendEnsureUser(env),
|
|
|
|
RunE: closeBackend(env, func(cmd *cobra.Command, args []string) error {
|
2020-06-28 19:26:29 +03:00
|
|
|
return runTermUI(env)
|
2021-05-09 12:33:20 +03:00
|
|
|
}),
|
2020-06-28 19:26:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func runTermUI(env *Env) error {
|
2020-06-28 20:09:32 +03:00
|
|
|
return termui.Run(env.backend)
|
2018-07-30 18:00:10 +03:00
|
|
|
}
|