scwrypts/py/scwrypts/getenv.py
yage eaefc99774 v2.0.0
=====================================================================

Subscwrypts + Environment Inheritance

--- Release Notes ------------------------

- added support for environment inheritance
- added support for arbitrarily nested scripts (subscwrypts)
- added support for CI mode

- improved modularity of zsh/utils module

- refactored to move some data from ~/.config/scwrypts to ~/.local/share/scwrypts

- refactored various scripts to use new subscwrypt api

--- New Scripts --------------------------

zsh )
  - db/interactive/postgres
  - aws/rds/interactive-login
2022-07-01 22:17:15 -06:00

17 lines
369 B
Python

from os import getenv as os_getenv
from py.scwrypts.exceptions import MissingVariableError
from py.scwrypts.run import run
def getenv(name, required=True):
value = os_getenv(name, None)
if value == None:
run('zsh/scwrypts/environment/stage-variables', name)
if required and not value:
raise MissingVariableError(name)
return value