diff options
Diffstat (limited to 'verbose.go')
| -rw-r--r-- | verbose.go | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/verbose.go b/verbose.go new file mode 100644 index 0000000..31dd0f7 --- /dev/null +++ b/verbose.go @@ -0,0 +1,55 @@ +package ENV + +// this is an experiment at this point to +// see how this turns out + +func Verbose() bool { + // always use the ENV value first + if envPB != nil { + found := envPB.FindByVar("Verbose") + if found == nil { + // Verbose isn't in the ENV. do nothing here + } else { + // return what the ENV has + // fmt.Println("returning from the ENV:" + found.Value) + if found.Value == "true" { + return true + } + return false + } + } + + // nothing in the ENV. check argv + for _, v := range argv { + if v == "--verbose" { + return true + } + } + return false +} + +func If(key string) bool { + // always use the ENV value first + if envPB != nil { + found := envPB.FindByVar(key) + if found == nil { + // Verbose isn't in the ENV. do nothing here + } else { + // return what the ENV has + // fmt.Println("returning from the ENV:" + found.Value) + if found.Value == "true" { + return true + } + return false + } + } + + // nothing in the ENV. check argv + // todo: turn key to lowercase and check here + for _, v := range argv { + if v == "--verbose" { + return true + } + } + return false +} |
