Coverage for src / ezqt_widgets / cli / commands / _docs.py: 0.00%
14 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-01 22:46 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-01 22:46 +0000
1# ///////////////////////////////////////////////////////////////
2# EZQT_WIDGETS - CLI Docs Command
3# Project: ezqt_widgets
4# ///////////////////////////////////////////////////////////////
6"""CLI command for opening ezqt-widgets 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/ezqt-widgets/"
26# ///////////////////////////////////////////////////////////////
27# COMMANDS
28# ///////////////////////////////////////////////////////////////
31@click.command(name="docs", help="Open the online documentation")
32def docs_command() -> None:
33 """Open the ezqt-widgets 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)