Print config stuff

This commit is contained in:
Brian Buller 2019-06-06 14:18:49 -05:00
parent 1c2d186843
commit d456c2c6c3
2 changed files with 22 additions and 0 deletions

View File

@ -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",

View File

@ -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 {