Skip to content
Snippets Groups Projects
Commit 9c3954ef authored by Daniele Serafini's avatar Daniele Serafini
Browse files

model: using f-strings in printNode function

parent cedf6fc9
No related branches found
No related tags found
1 merge request!3model: using f-strings in printNode function
......@@ -70,21 +70,18 @@ class Tree:
def printNode(self, node: Any, isatty: bool, inc: int) -> None:
rel_path = str(node.path.relative_to(self.path))
print(''*inc, end='')
if node.otype == DIRECTORY:
if node.pid:
print(colorize(rel_path, Color.blue) if isatty else rel_path,
end='')
else:
print(colorize(rel_path, Color.red) if isatty else rel_path,
end='')
print('/')
elif node.otype == CONTENT:
if node.pid:
print(colorize(rel_path, Color.green) if isatty else rel_path)
else:
print(colorize(rel_path, Color.red) if isatty else rel_path)
begin = '' * inc
end = '/' if node.otype == DIRECTORY else ''
if isatty:
if not node.pid:
rel_path = colorize(rel_path, Color.red)
elif node.otype == DIRECTORY:
rel_path = colorize(rel_path, Color.blue)
elif node.otype == CONTENT:
rel_path = colorize(rel_path, Color.green)
print(f'{begin}{rel_path}{end}')
def getJsonTree(self):
"""Walk through the tree to discover content or directory that have
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment