Merge pull request #347 from scopatz/dirs

Added DIRS rule to environ
This commit is contained in:
adam j hartz 2015-08-12 23:19:34 -04:00
commit f1c0843bde
2 changed files with 4 additions and 1 deletions

View file

@ -142,8 +142,10 @@ Like other variables in Python, environment variables have a type. Sometimes
this type is imposed based on the variable name. The current rules are pretty this type is imposed based on the variable name. The current rules are pretty
simple: simple:
* ``PATH``: any variable whose name contains PATH is a list of strings. * ``\w*PATH``: any variable whose name ends in PATH is a list of strings.
* ``\w*DIRS``: any variable whose name ends in DIRS is a list of strings.
* ``XONSH_HISTORY_SIZE``: this variable is an int. * ``XONSH_HISTORY_SIZE``: this variable is an int.
* ``CASE_SENSITIVE_COMPLETIONS``: this variable is a boolean.
xonsh will automatically convert back and forth to untyped (string-only) xonsh will automatically convert back and forth to untyped (string-only)
representations of the environment as needed (mostly by subprocess commands). representations of the environment as needed (mostly by subprocess commands).

View file

@ -44,6 +44,7 @@ represent environment variable validation, conversion, detyping.
DEFAULT_ENSURERS = { DEFAULT_ENSURERS = {
re.compile('\w*PATH'): (is_env_path, str_to_env_path, env_path_to_str), re.compile('\w*PATH'): (is_env_path, str_to_env_path, env_path_to_str),
re.compile('\w*DIRS'): (is_env_path, str_to_env_path, env_path_to_str),
'LC_CTYPE': (always_false, locale_convert('LC_CTYPE'), ensure_string), 'LC_CTYPE': (always_false, locale_convert('LC_CTYPE'), ensure_string),
'LC_MESSAGES': (always_false, locale_convert('LC_MESSAGES'), ensure_string), 'LC_MESSAGES': (always_false, locale_convert('LC_MESSAGES'), ensure_string),
'LC_COLLATE': (always_false, locale_convert('LC_COLLATE'), ensure_string), 'LC_COLLATE': (always_false, locale_convert('LC_COLLATE'), ensure_string),