Skip to content

Commit

Permalink
Fix header when hexdoc is not installed in a subdirectory of the cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
object-Object committed Feb 22, 2024
1 parent 8169a4a commit c8e1464
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/hexdoc/cli/utils/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,10 @@ def _relative_path(path: Path):
cwd = Path.cwd()
if path == cwd:
return "."
return f".{os.sep}{path.relative_to(cwd)}"

try:
path = path.relative_to(cwd)
except ValueError:
return str(path)

return f".{os.sep}{path}"

0 comments on commit c8e1464

Please sign in to comment.