Changeset View
Changeset View
Standalone View
Standalone View
swh/scanner/output.py
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | class Output: | ||||
def print_node(self, node: Any, isatty: bool, level: int) -> None: | def print_node(self, node: Any, isatty: bool, level: int) -> None: | ||||
rel_path = os.path.basename(node.data[self.get_path_name(node)]) | rel_path = os.path.basename(node.data[self.get_path_name(node)]) | ||||
rel_path = rel_path.decode() | rel_path = rel_path.decode() | ||||
begin = "│ " * level | begin = "│ " * level | ||||
end = "/" if node.object_type == "directory" else "" | end = "/" if node.object_type == "directory" else "" | ||||
if isatty: | if isatty: | ||||
if not self.nodes_data[str(node.swhid())]["known"]: | if not self.nodes_data[node.swhid()]["known"]: | ||||
rel_path = colorize(rel_path, Color.RED) | rel_path = colorize(rel_path, Color.RED) | ||||
elif node.object_type == "directory": | elif node.object_type == "directory": | ||||
rel_path = colorize(rel_path, Color.BLUE) | rel_path = colorize(rel_path, Color.BLUE) | ||||
elif node.object_type == "content": | elif node.object_type == "content": | ||||
rel_path = colorize(rel_path, Color.GREEN) | rel_path = colorize(rel_path, Color.GREEN) | ||||
print(f"{begin}{rel_path}{end}") | print(f"{begin}{rel_path}{end}") | ||||
Show All 16 Lines |