Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

44 righe
1.3 KiB

  1. from typing import Any, Optional # noqa
  2. from .main import load_dotenv, get_key, set_key, unset_key, find_dotenv, dotenv_values
  3. def load_ipython_extension(ipython):
  4. # type: (Any) -> None
  5. from .ipython import load_ipython_extension
  6. load_ipython_extension(ipython)
  7. def get_cli_string(path=None, action=None, key=None, value=None, quote=None):
  8. # type: (Optional[str], Optional[str], Optional[str], Optional[str], Optional[str]) -> str
  9. """Returns a string suitable for running as a shell script.
  10. Useful for converting a arguments passed to a fabric task
  11. to be passed to a `local` or `run` command.
  12. """
  13. command = ['dotenv']
  14. if quote:
  15. command.append('-q %s' % quote)
  16. if path:
  17. command.append('-f %s' % path)
  18. if action:
  19. command.append(action)
  20. if key:
  21. command.append(key)
  22. if value:
  23. if ' ' in value:
  24. command.append('"%s"' % value)
  25. else:
  26. command.append(value)
  27. return ' '.join(command).strip()
  28. __all__ = ['get_cli_string',
  29. 'load_dotenv',
  30. 'dotenv_values',
  31. 'get_key',
  32. 'set_key',
  33. 'unset_key',
  34. 'find_dotenv',
  35. 'load_ipython_extension']