add list of voids held open by current shells to the prompt
This commit is contained in:
parent
6e65590d03
commit
6931f58a73
2 changed files with 25 additions and 3 deletions
|
@ -130,7 +130,7 @@ function mkvoid () {
|
|||
mkdir -p "${__MKVOID_DIR}" || die "mkdir fs"
|
||||
ln -s "${__MKVOID_ID}" "${__MKVOID_PATH}" || die "ln"
|
||||
pushd "${__MKVOID_PATH}" > /dev/null || die "pushd"
|
||||
zsh
|
||||
OVER_PROMPT_VOIDS="$OVER_PROMPT_VOIDS:$__MKVOID_NAME" zsh
|
||||
popd > /dev/null
|
||||
rm -f "${__MKVOID_PATH}" || die "rm link"
|
||||
rm -rf "${__MKVOID_ID}" || die "rm void"
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue