Merge pull request #2323 from xonsh/prettypath

Pretty path
This commit is contained in:
Konstantinos Tsakiltzidis 2017-03-16 10:08:33 +02:00 committed by GitHub
commit 36deaeeb4e
2 changed files with 25 additions and 0 deletions

13
news/pretty_path.rst Normal file
View file

@ -0,0 +1,13 @@
**Added:**
* Pretty printing of the $PATH variable
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -204,6 +204,18 @@ class EnvPath(collections.MutableSequence):
return False
return all(map(operator.eq, self, other))
def _repr_pretty_(self, p, cycle):
""" Pretty print path list """
if cycle:
p.text('EnvPath(...)')
else:
with p.group(1, 'EnvPath(\n[', ']\n)'):
for idx, item in enumerate(self):
if idx:
p.text(',')
p.breakable()
p.pretty(item)
class DefaultNotGivenType(object):
"""Singleton for representing when no default value is given."""