click.py 376 B

12345678910111213141516
  1. """Extensions for use with click options"""
  2. import os
  3. def envvar(name, default):
  4. """Create callable environment variable getter
  5. :param str name: Name of environment variable
  6. :param default: Default value to return in case it isn't defined
  7. """
  8. return lambda: os.environ.get(name, default)
  9. def flag_ennvar(name):
  10. return os.environ.get(name) == '1'