File: path.py

package info (click to toggle)
zabbix-cli 3.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,980 kB
  • sloc: python: 19,920; makefile: 5
file content (15 lines) | stat: -rw-r--r-- 390 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""Control the formatting of console output."""

from __future__ import annotations

from pathlib import Path


def path_link(path: Path, *, absolute: bool = True) -> str:
    """Return a link to a path."""
    abspath = path.resolve().absolute()
    if absolute:
        path_str = str(abspath)
    else:
        path_str = str(path)
    return f"[link=file://{abspath}]{path_str}[/link]"