2016-12-22 23:04:21 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2017-02-07 04:33:09 +01:00
|
|
|
"github.com/bcicen/ctop/config"
|
2017-02-04 03:01:52 +01:00
|
|
|
"github.com/bcicen/ctop/logging"
|
2017-01-01 23:48:35 +01:00
|
|
|
ui "github.com/gizak/termui"
|
2016-12-22 23:04:21 +01:00
|
|
|
)
|
|
|
|
|
2017-02-12 06:10:40 +01:00
|
|
|
var log *logging.CTopLogger
|
2017-02-04 03:01:52 +01:00
|
|
|
|
2016-12-26 00:05:22 +01:00
|
|
|
func main() {
|
2017-02-16 04:49:41 +01:00
|
|
|
config.Init()
|
2017-02-12 06:14:50 +01:00
|
|
|
log = logging.Init()
|
2017-02-16 05:06:05 +01:00
|
|
|
if config.GetSwitchVal("loggingEnabled") {
|
2017-02-17 07:48:38 +01:00
|
|
|
logging.StartServer()
|
2017-02-12 06:14:50 +01:00
|
|
|
}
|
2017-01-01 23:48:35 +01:00
|
|
|
if err := ui.Init(); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
defer ui.Close()
|
2017-01-03 18:37:09 +01:00
|
|
|
|
2016-12-30 22:14:07 +01:00
|
|
|
g := NewGrid()
|
2017-01-01 23:42:13 +01:00
|
|
|
for {
|
|
|
|
exit := Display(g)
|
|
|
|
if exit {
|
2017-02-05 01:25:30 +01:00
|
|
|
log.Notice("shutting down")
|
|
|
|
log.Exit()
|
2017-01-01 23:48:35 +01:00
|
|
|
return
|
2017-01-01 23:42:13 +01:00
|
|
|
}
|
2016-12-22 23:04:21 +01:00
|
|
|
}
|
|
|
|
}
|