From d456c2c6c310ad62301e003ce3e1fd9b389c76ca Mon Sep 17 00:00:00 2001 From: Brian Buller Date: Thu, 6 Jun 2019 14:18:49 -0500 Subject: [PATCH] Print config stuff --- app_state.go | 6 ++++++ timer_ops.go | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/app_state.go b/app_state.go index 253936d..7d9da3b 100644 --- a/app_state.go +++ b/app_state.go @@ -205,6 +205,12 @@ func (a *AppState) initialize() { }, a.opPrintUsage, ) + a.addOperation("config", + []string{ + "config - Print or edit config", + }, + a.opConfig, + ) a.addOperation("--h", []string{ "--h - Print this message", diff --git a/timer_ops.go b/timer_ops.go index 3c8a497..f628d12 100644 --- a/timer_ops.go +++ b/timer_ops.go @@ -416,6 +416,22 @@ func (a *AppState) opFuzzyParse(args []string) int { return 0 } +func (a *AppState) opConfig(args []string) int { + if len(args) == 0 { + fmt.Println("Config Keys:") + for _, v := range a.config.GetKeyList() { + fmt.Println(" " + v) + } + } else { + if args[0] == "timerpath" { + fmt.Println(a.directory + a.fileTimer) + } else { + fmt.Println(a.config.Get(args[0])) + } + } + return 0 +} + func (a *AppState) opPrintUsage(args []string) int { for _, v := range a.ValidOperations { for _, vv := range v {