add void information to prompt
This commit is contained in:
parent
574bc76127
commit
6e65590d03
1 changed files with 11 additions and 0 deletions
|
@ -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):
|
||||
|
@ -242,6 +246,10 @@ class Dir:
|
|||
self.color = COLOR_DIR_RO
|
||||
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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue