Remove printSetting switch from cmdSet

This commit is contained in:
2019-10-22 08:45:37 -04:00
parent 8cab261b1d
commit cc917a515f

View File

@ -19,32 +19,34 @@ func init() {
RegisterCommand(command) RegisterCommand(command)
} }
func printSetting(cmd []string) {
switch cmd[1] {
case "load":
loadFromToml()
printToView("Feed", fmt.Sprintf("Loading config from toml"))
case "downloadPath":
printToView("Feed", fmt.Sprintf("Setting for %s -> %s", cmd[1], downloadPath))
case "outputFormat":
printToView("Feed", fmt.Sprintf("Setting for %s -> %s", cmd[1], outputFormat))
case "dateFormat":
printToView("Feed", fmt.Sprintf("Setting for %s -> %s", cmd[1], dateFormat))
case "timeFormat":
printToView("Feed", fmt.Sprintf("Setting for %s -> %s", cmd[1], timeFormat))
case "cmdPrefix":
printToView("Feed", fmt.Sprintf("Setting for %s -> %s", cmd[1], cmdPrefix))
default:
printToView("Feed", fmt.Sprintf("Unknown config value %s", cmd[1]))
}
return
}
func cmdSet(cmd []string) { func cmdSet(cmd []string) {
if len(cmd) < 2 { if len(cmd) < 2 {
printToView("Feed", "No config value specified") printToView("Feed", "No config value specified")
return return
} }
if len(cmd) < 3 { if len(cmd) < 3 {
switch cmd[1] { printSetting(cmd)
case "load":
loadFromToml()
printToView("Feed", fmt.Sprintf("Loading config from toml"))
case "downloadPath":
printToView("Feed", fmt.Sprintf("Setting for %s -> %s", cmd[1], downloadPath))
case "outputFormat":
printToView("Feed", fmt.Sprintf("Setting for %s -> %s", cmd[1], outputFormat))
case "dateFormat":
printToView("Feed", fmt.Sprintf("Setting for %s -> %s", cmd[1], dateFormat))
case "timeFormat":
printToView("Feed", fmt.Sprintf("Setting for %s -> %s", cmd[1], timeFormat))
case "cmdPrefix":
printToView("Feed", fmt.Sprintf("Setting for %s -> %s", cmd[1], cmdPrefix))
default:
printToView("Feed", fmt.Sprintf("Unknown config value %s", cmd[1]))
}
return
} }
switch cmd[1] { switch cmd[1] {
case "downloadPath": case "downloadPath":