diff options
Diffstat (limited to 'flags.go')
| -rw-r--r-- | flags.go | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/flags.go b/flags.go deleted file mode 100644 index 24a3fce..0000000 --- a/flags.go +++ /dev/null @@ -1,55 +0,0 @@ -package config - -// returns true if config is working okay -func InitValid() bool { - if configPB == nil { - // todo: try to re-init it here - return false - } - return true -} - -func Get(flag string) string { - if configPB == nil { - return "" - } - found := configPB.FindByKey(flag) - if found == nil { - return "" - } - return found.Value -} - -func GetPanic(flag string) string { - if configPB == nil { - configPanic(flag) - } - found := configPB.FindByKey(flag) - if found == nil { - configPanic(flag) - } - return found.Value -} - -func configPanic(varname string) { - if configPB == nil { - panic("config file is nil") - } - panic("config name '" + varname + "' not found") -} - -func Set(key string, newValue string) error { - if configPB == nil { - return NotInitialized - } - found := configPB.FindByKey(key) - if found != nil { - found.Value = newValue - } - - newvar := new(Config) - newvar.Key = key - newvar.Value = newValue - configPB.Append(newvar) - return nil -} |
