Merge pull request #768 from gforsyth/ellipsis

add ellipsis lookup to xonsh environ
This commit is contained in:
Anthony Scopatz 2016-03-31 17:25:23 -04:00
commit 3904bb3800
3 changed files with 11 additions and 0 deletions

View file

@ -12,6 +12,7 @@ Current Developments
* Automatically enhance colors for readability in the default terminal (cmd.exe)
on Windows. This functionality can be enabled/disabled with the
$INTENSIFY_COLORS_ON_WIN environment variable.
* Added ``Ellipsis`` lookup to ``__xonsh_env__`` to allow environment variable checks, e.g. ``'HOME' in ${...}``
**Changed:**

View file

@ -197,6 +197,14 @@ examples in action:
Not bad, xonsh, not bad.
If you want to check if an environment variable is present in your current
session (say, in your awesome new ``xonsh`` script) you can pass an Ellipsis to
the ``${}`` operator:
.. code-block:: xonshcon
>>> 'HOME' in ${...}
True
Running Commands
==============================

View file

@ -585,6 +585,8 @@ class Env(MutableMapping):
#
def __getitem__(self, key):
if key is Ellipsis:
return self
m = self._arg_regex.match(key)
if (m is not None) and (key not in self._d) and ('ARGS' in self._d):
args = self._d['ARGS']