2018-07-30 18:00:10 +03:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2018-08-31 14:18:03 +03:00
|
|
|
"github.com/MichaelMure/git-bug/cache"
|
2018-07-30 18:00:10 +03:00
|
|
|
"github.com/MichaelMure/git-bug/termui"
|
2018-10-25 00:36:39 +03:00
|
|
|
"github.com/MichaelMure/git-bug/util/interrupt"
|
2018-07-30 18:00:10 +03:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func runTermUI(cmd *cobra.Command, args []string) error {
|
2018-08-31 14:18:03 +03:00
|
|
|
backend, err := cache.NewRepoCache(repo)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
defer backend.Close()
|
2018-10-25 00:36:39 +03:00
|
|
|
interrupt.RegisterCleaner(backend.Close)
|
2018-08-31 14:18:03 +03:00
|
|
|
|
|
|
|
return termui.Run(backend)
|
2018-07-30 18:00:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
var termUICmd = &cobra.Command{
|
2018-10-17 21:38:10 +03:00
|
|
|
Use: "termui",
|
2019-08-31 14:25:44 +03:00
|
|
|
Aliases: []string{"tui"},
|
2019-02-24 16:46:08 +03:00
|
|
|
Short: "Launch the terminal UI.",
|
2019-02-23 15:01:46 +03:00
|
|
|
PreRunE: loadRepoEnsureUser,
|
2018-10-17 21:38:10 +03:00
|
|
|
RunE: runTermUI,
|
2018-07-30 18:00:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
RootCmd.AddCommand(termUICmd)
|
|
|
|
}
|