summaryrefslogtreecommitdiff
path: root/true.go
diff options
context:
space:
mode:
Diffstat (limited to 'true.go')
-rw-r--r--true.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/true.go b/true.go
new file mode 100644
index 0000000..927a77d
--- /dev/null
+++ b/true.go
@@ -0,0 +1,21 @@
+package env
+
+import (
+ "strings"
+)
+
+func True(flag string) bool {
+ saveMu.Lock()
+ defer saveMu.Unlock()
+ if envPB == nil {
+ return false
+ }
+ found := envPB.FindByVar(flag)
+ if found == nil {
+ return false
+ }
+ if strings.ToLower(found.Value) == "true" {
+ return true
+ }
+ return false
+}