Do it fullscreen

This commit is contained in:
Christian Rocha 2020-05-13 19:15:39 -04:00 committed by Christian Muehlhaeuser
commit 25340455a7
3 changed files with 12 additions and 5 deletions

2
go.mod
View file

@ -10,7 +10,7 @@ require (
github.com/charmbracelet/teaparty v0.0.0-20200504225426-da64445a0e0d
github.com/dlclark/regexp2 v1.2.0 // indirect
github.com/muesli/reflow v0.1.0
github.com/muesli/termenv v0.5.2
github.com/muesli/termenv v0.6.0
github.com/spf13/cobra v0.0.7
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect

View file

@ -152,13 +152,20 @@ func execute(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
//return executeArg(cmd, "", os.Stdout)
debug := os.Getenv("GLOW_DEBUG")
if debug != "" {
boba.UseSysLog("glow")
}
boba.AltScreen()
if err := ui.NewProgram().Start(); err != nil {
return err
}
boba.ExitAltScreen()
fmt.Println("\n Thanks for using Glow!\n")
return nil
}
for _, arg := range args {

View file

@ -32,7 +32,6 @@ const (
stateKeygenRunning
stateKeygenFinished
stateShowStash
stateQuitting
)
type model struct {
@ -75,8 +74,11 @@ func update(msg boba.Msg, mdl boba.Model) (boba.Model, boba.Cmd) {
case boba.KeyMsg:
switch msg.String() {
case "q":
fallthrough
case "esc":
fallthrough
case "ctrl+c":
m.state = stateQuitting
return m, boba.Quit
}
@ -164,8 +166,6 @@ func view(mdl boba.Model) string {
s += spinner.View(m.spinner) + " Re-initializing..."
case stateShowStash:
s += stashView(m.stash)
case stateQuitting:
s += "Thanks for using Glow!"
}
if m.state != stateShowStash {
s = "\n" + indent.String(s, 2)