fix: update config file handling
- show default config in help - only use default config if exists, otherwise use passed file
This commit is contained in:
parent
8a0ef32c91
commit
d4d14aa94a
1 changed files with 4 additions and 4 deletions
|
@ -64,16 +64,16 @@ func Start() {
|
||||||
|
|
||||||
parameter_url = flag.String("url", "", "GoTomato Server URL (eg ws://localhost:8080/ws)")
|
parameter_url = flag.String("url", "", "GoTomato Server URL (eg ws://localhost:8080/ws)")
|
||||||
parameter_password = flag.String("password", "", "Control password for pomodoro session")
|
parameter_password = flag.String("password", "", "Control password for pomodoro session")
|
||||||
configfile = flag.String("config", "", "Path to config file")
|
configfile = flag.String("config", defaultConfigFile, "Path to config file")
|
||||||
)
|
)
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
// read passed config file or try to use default config
|
// read passed config file or try to use default config
|
||||||
if *configfile != "" {
|
if *configfile != defaultConfigFile {
|
||||||
config = helper.ParseConfig(*configfile)
|
config = helper.ParseConfig(*configfile)
|
||||||
} else {
|
} else {
|
||||||
if helper.FileExists(defaultConfigFile) {
|
if helper.FileExists(*configfile) {
|
||||||
config = helper.ParseConfig(defaultConfigFile)
|
config = helper.ParseConfig(*configfile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue