mirror of https://github.com/miguelmota/cointop
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.
40 lines
674 B
Go
40 lines
674 B
Go
package cointop
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/cointop-sh/cointop/pkg/gocui"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// Quit quits the program
|
|
func (ct *Cointop) Quit() error {
|
|
ct.logfile.Close()
|
|
return gocui.ErrQuit
|
|
}
|
|
|
|
// QuitView exists the current view
|
|
func (ct *Cointop) QuitView() error {
|
|
log.Debug("QuitView()")
|
|
if ct.State.selectedView != CoinsView {
|
|
ct.SetSelectedView(CoinsView)
|
|
return ct.UpdateTable()
|
|
}
|
|
if ct.ui.ActiveViewName() == ct.Views.Table.Name() {
|
|
return ct.Quit()
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// Exit safely exits the program
|
|
func (ct *Cointop) Exit() {
|
|
log.Debug("Exit()")
|
|
ct.logfile.Close()
|
|
if ct.g != nil {
|
|
ct.g.Close()
|
|
} else {
|
|
os.Exit(0)
|
|
}
|
|
}
|