turtle
turtle copied to clipboard
Check if an environment variable is set
In Bash, it's very common to check if an environment is set and non-empty with [[ -n "${VAR:-}" ]]. We should provide helpers for this, like so:
hasEnv :: Text -> IO Bool
hasEnv = not . missingEnv
missingEnv :: Text -> IO Bool
missingEnv name = null $ fromMaybe "" $ need name
Let me know if https://github.com/Gabriella439/turtle/pull/454 looks okay to you