add void information to prompt

This commit is contained in:
Martinez 2017-09-30 18:42:00 +02:00
parent 574bc76127
commit 6e65590d03

View file

@ -58,6 +58,9 @@ def style_color(fg):
def style_bold():
return "\033[1m"
def style_invert():
return "\033[7m"
def style_reset():
return "\033[0m"
@ -234,6 +237,7 @@ class Dir:
self.path = path
self.slash = slash
self.truncated = False
self.void = False
self.name = os.path.basename(path) if name is None else name
if os.access(path, os.W_OK):
@ -243,6 +247,10 @@ class Dir:
else:
self.color = COLOR_DIR_NO
if os.path.islink(path) and os.path.realpath(path).startswith("/dev/shm/void"):
self.name = "«" + self.name + "»"
self.void = True
def __len__(self):
return len(self.name) + len(self.slash)
@ -258,6 +266,9 @@ class Dir:
if self.truncated:
output.append(style_bold())
if self.void:
output.append(style_invert())
output.append(style_color(self.color))
output.append(self.name)