Coverage for src / ezxl / cli / commands / _docs.py: 100.00%
14 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-10-17 10:25 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-10-17 10:25 +0000
1# ///////////////////////////////////////////////////////////////
2# EZXL - CLI Docs Command
3# Project: ezxl
4# ///////////////////////////////////////////////////////////////
6"""CLI command for opening ezxl online documentation."""
8from __future__ import annotations
10# ///////////////////////////////////////////////////////////////
11# IMPORTS
12# ///////////////////////////////////////////////////////////////
13# Standard library imports
14import webbrowser
16# Third-party imports
17import click
19# ///////////////////////////////////////////////////////////////
20# CONSTANTS
21# ///////////////////////////////////////////////////////////////
23DOCS_URL = "https://neuraaak.github.io/ezxl/"
26# ///////////////////////////////////////////////////////////////
27# COMMANDS
28# ///////////////////////////////////////////////////////////////
31@click.command(name="docs", help="Open the online documentation")
32def docs_command() -> None:
33 """Open the ezxl documentation website in the default browser."""
34 try:
35 opened = webbrowser.open(DOCS_URL, new=2)
36 except (OSError, RuntimeError, webbrowser.Error) as e:
37 raise click.ClickException(str(e)) from e
39 if opened:
40 click.echo(f"Opened documentation: {DOCS_URL}")
41 return
43 # Fallback for environments where a browser cannot be opened.
44 click.echo(DOCS_URL)