summaryrefslogtreecommitdiff
path: root/verbose.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-21 06:40:48 -0500
committerJeff Carr <[email protected]>2025-10-21 06:40:48 -0500
commit3cf635e3c41be385b50778f7818fd50b006f1671 (patch)
treedba1a8c80e363d4f86a5f81623bc1f603e39318e /verbose.go
parent4d3349c453879051a7499fa07a97dfcb20b554ea (diff)
something to act like bash ENV
Diffstat (limited to 'verbose.go')
-rw-r--r--verbose.go55
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
+}