Coverage for harbor_cli/output/formatting/path.py: 100%
8 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-02-09 12:09 +0100
« prev ^ index » next coverage.py v6.5.0, created at 2023-02-09 12:09 +0100
1"""Control the formatting of console output."""
2from __future__ import annotations
4from pathlib import Path
7def path_link(path: Path, absolute: bool = True) -> str:
8 """Return a link to a path."""
9 abspath = path.resolve().absolute()
10 if absolute:
11 path_str = str(abspath)
12 else:
13 path_str = str(path)
14 return f"[link=file://{abspath}]{path_str}[/link]"