From acc9a6f3a6df2961c3ae44352216d915cb9b5315 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sat, 10 Sep 2022 11:09:19 +0200 Subject: commands: reorg into different packages --- commands/termui.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'commands/termui.go') diff --git a/commands/termui.go b/commands/termui.go index 4df6cdaf..1cfdd8f3 100644 --- a/commands/termui.go +++ b/commands/termui.go @@ -3,18 +3,19 @@ package commands import ( "github.com/spf13/cobra" + "github.com/MichaelMure/git-bug/commands/execenv" "github.com/MichaelMure/git-bug/termui" ) func newTermUICommand() *cobra.Command { - env := newEnv() + env := execenv.NewEnv() cmd := &cobra.Command{ Use: "termui", Aliases: []string{"tui"}, - Short: "Launch the terminal UI.", - PreRunE: loadBackendEnsureUser(env), - RunE: closeBackend(env, func(cmd *cobra.Command, args []string) error { + Short: "Launch the terminal UI", + PreRunE: execenv.LoadBackendEnsureUser(env), + RunE: execenv.CloseBackend(env, func(cmd *cobra.Command, args []string) error { return runTermUI(env) }), } @@ -22,6 +23,6 @@ func newTermUICommand() *cobra.Command { return cmd } -func runTermUI(env *Env) error { - return termui.Run(env.backend) +func runTermUI(env *execenv.Env) error { + return termui.Run(env.Backend) } -- cgit