add VirtualEnvPart
This commit is contained in:
parent
63210a3f4d
commit
10388217e6
1 changed files with 20 additions and 1 deletions
|
@ -316,6 +316,24 @@ def command(cmd):
|
||||||
|
|
||||||
return s.stdout.read().decode("utf-8")
|
return s.stdout.read().decode("utf-8")
|
||||||
|
|
||||||
|
class VirtualEnvPart(Part):
|
||||||
|
"""
|
||||||
|
⬢ path
|
||||||
|
|
||||||
|
Displays the current python virtualenv's path iff set.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
Part.__init__(self)
|
||||||
|
|
||||||
|
virtualenv = os.getenv("VIRTUAL_ENV")
|
||||||
|
|
||||||
|
if virtualenv:
|
||||||
|
self.fragments.append("⬢ ")
|
||||||
|
self.fragments.append(style_color(COLOR_GIT_CLEAN))
|
||||||
|
self.fragments.append(virtualenv)
|
||||||
|
self.fragments.append(style_reset())
|
||||||
|
|
||||||
class GitPart(Part):
|
class GitPart(Part):
|
||||||
"""
|
"""
|
||||||
↘2 ↗4 ⚠master ?11 ✎6 ✉10
|
↘2 ↗4 ⚠master ?11 ✎6 ✉10
|
||||||
|
@ -541,10 +559,11 @@ if __name__ == "__main__":
|
||||||
lp = LoginPart(settings, sysload)
|
lp = LoginPart(settings, sysload)
|
||||||
pp = PathPart(settings)
|
pp = PathPart(settings)
|
||||||
gp = GitPart()
|
gp = GitPart()
|
||||||
|
vp = VirtualEnvPart()
|
||||||
pad = Padding(settings.term_width)
|
pad = Padding(settings.term_width)
|
||||||
sp = StatsPart(settings, sysload)
|
sp = StatsPart(settings, sysload)
|
||||||
|
|
||||||
line = [lp, pp, gp, pad, sp]
|
line = [lp, pp, gp, vp, pad, sp]
|
||||||
|
|
||||||
pp.shrink_fit(line)
|
pp.shrink_fit(line)
|
||||||
pad.expand_fit(line)
|
pad.expand_fit(line)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue