aboutsummaryrefslogblamecommitdiffstats
path: root/commands/termui.go
blob: 08eba1d699616417ea2a48c70e6259b2be53ad8f (plain) (tree)
1
2
3
4
5
6
7
8
9


                

                                
                                                         
                                               

 
                                                        
                              

                                         


                                                                                               
                                             
                   




                  

                                        
 
package commands

import (
	"github.com/spf13/cobra"

	"github.com/MichaelMure/git-bug/commands/execenv"
	"github.com/MichaelMure/git-bug/termui"
)

func newTermUICommand(env *execenv.Env) *cobra.Command {
	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 {
			return runTermUI(env)
		}),
	}

	return cmd
}

func runTermUI(env *execenv.Env) error {
	return termui.Run(env.Backend)
}