You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cointop/cointop/quit.go

41 lines
673 B
Go

6 years ago
package cointop
import (
"os"
"github.com/miguelmota/gocui"
6 years ago
)
// Quit quites the program
func (ct *Cointop) Quit() error {
6 years ago
return gocui.ErrQuit
}
// QuitView exists the current view
func (ct *Cointop) QuitView() error {
ct.debuglog("quitView()")
if ct.IsPortfolioVisible() {
ct.SetSelectedView(CoinsView)
return ct.UpdateTable()
6 years ago
}
if ct.IsFavoritesVisible() {
ct.SetSelectedView(CoinsView)
return ct.UpdateTable()
6 years ago
}
if ct.ui.ActiveViewName() == ct.Views.Table.Name() {
return ct.Quit()
6 years ago
}
return nil
}
// Exit safely exits the program
6 years ago
func (ct *Cointop) Exit() {
ct.debuglog("exit()")
6 years ago
if ct.g != nil {
ct.g.Close()
} else {
os.Exit(0)
}
}