summaryrefslogtreecommitdiff
path: root/verbose.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-15 00:25:32 -0500
committerJeff Carr <[email protected]>2025-10-15 00:25:32 -0500
commit6bf6cd03a651013a327d31427d0366cd8aa1c8de (patch)
tree5d744cc6ab2c7a4569379a0522371e8e2862e03a /verbose.go
parent97a695752040ccf96335c5e593bd9856a61a5fb6 (diff)
try out an If(key) functionv0.0.25
Diffstat (limited to 'verbose.go')
-rw-r--r--verbose.go31
1 files changed, 30 insertions, 1 deletions
diff --git a/verbose.go b/verbose.go
index 4658dcf..d08885c 100644
--- a/verbose.go
+++ b/verbose.go
@@ -7,8 +7,36 @@ func Verbose() bool {
// always use the config file value first
if configPB != nil {
found := configPB.FindByKey("Verbose")
+ if found == nil {
+ // Verbose isn't in the config. do nothing here
+ } else {
+ // return what the config file has
+ // fmt.Println("returning from the config:" + found.Value)
+ if found.Value == "true" {
+ return true
+ }
+ return false
+ }
+ }
- if found != nil {
+ // nothing in the config file. check argv
+ for _, v := range argv {
+ if v == "--verbose" {
+ return true
+ }
+ }
+ return false
+}
+
+func If(key string) bool {
+ // always use the config file value first
+ if configPB != nil {
+ found := configPB.FindByKey(key)
+ if found == nil {
+ // Verbose isn't in the config. do nothing here
+ } else {
+ // return what the config file has
+ // fmt.Println("returning from the config:" + found.Value)
if found.Value == "true" {
return true
}
@@ -17,6 +45,7 @@ func Verbose() bool {
}
// nothing in the config file. check argv
+ // todo: turn key to lowercase and check here
for _, v := range argv {
if v == "--verbose" {
return true