add list of voids held open by current shells to the prompt

This commit is contained in:
Martinez 2017-09-30 20:21:46 +02:00
parent 6e65590d03
commit 6931f58a73
2 changed files with 25 additions and 3 deletions

View file

@ -359,6 +359,27 @@ class VirtualEnvPart(Part):
self.fragments.append(venv_name)
self.fragments.append(style_reset())
class VoidPart(Part):
"""
name
Displays the name(s) of the VOIDs held by the current shell and its ancestors.
"""
def __init__(self):
Part.__init__(self)
voids = os.getenv("OVER_PROMPT_VOIDS")
if voids:
self.fragments.append("")
for void in voids.split(":"):
if void:
self.fragments.append(style_color(COLOR_OK))
self.fragments.append(void)
self.fragments.append(style_reset())
class WineprefixPart(Part):
"""
name:[32|64]
@ -652,12 +673,13 @@ if __name__ == "__main__":
lp = LoginPart(settings, sysload)
pp = PathPart(settings, overloaded)
gp = "" if overloaded else GitPart()
vp = VirtualEnvPart()
vep = VirtualEnvPart()
vop = VoidPart()
wp = WineprefixPart()
pad = Padding(settings.term_width)
sp = StatsPart(settings, sysload)
line = [lp, pp, gp, vp, wp, pad, sp]
line = [lp, pp, gp, vep, vop, wp, pad, sp]
pp.shrink_fit(line)
pad.expand_fit(line)