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


                

                                
                                               

 



                                        




                                                     








                                                                     
                                      
 
package commands

import (
	"github.com/spf13/cobra"

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

func newTermUICommand() *cobra.Command {
	env := newEnv()

	cmd := &cobra.Command{
		Use:      "termui",
		Aliases:  []string{"tui"},
		Short:    "Launch the terminal UI.",
		PreRunE:  loadBackendEnsureUser(env),
		PostRunE: closeBackend(env),
		RunE: func(cmd *cobra.Command, args []string) error {
			return runTermUI(env)
		},
	}

	return cmd
}

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