Coverage for src / ezpl / cli / commands / version.py: 29.03%
27 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-13 19:35 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-13 19:35 +0000
1# ///////////////////////////////////////////////////////////////
2# EZPL - CLI Version Command
3# Project: ezpl
4# ///////////////////////////////////////////////////////////////
6"""
7CLI command for displaying version information.
9This module provides the version command for Ezpl.
10"""
12from __future__ import annotations
14# ///////////////////////////////////////////////////////////////
15# IMPORTS
16# ///////////////////////////////////////////////////////////////
17# Standard library imports
18import click
20# Third-party imports
21from rich.panel import Panel
22from rich.text import Text
24# Local imports
25import ezpl
27from .._console import console
29# ///////////////////////////////////////////////////////////////
30# COMMANDS
31# ///////////////////////////////////////////////////////////////
34@click.command(name="version", help="Display version information")
35@click.option(
36 "--full",
37 "-f",
38 is_flag=True,
39 help="Display full version information",
40)
41def version_command(full: bool) -> None:
42 """
43 Display version information.
45 Show the current version of Ezpl.
46 Use --full for detailed version information.
47 """
48 version = getattr(ezpl, "__version__", "unknown")
49 author = getattr(ezpl, "__author__", "unknown")
50 license_type = getattr(ezpl, "__license__", "unknown")
52 if full:
53 # Full version info
54 text = Text()
55 text.append("Ezpl ", style="bold bright_blue")
56 text.append(f"v{version}", style="bold green")
57 text.append("\n\n", style="reset")
59 text.append("Author: ", style="dim")
60 text.append(f"{author}\n", style="white")
61 text.append("License: ", style="dim")
62 text.append(f"{license_type}\n", style="white")
64 if hasattr(ezpl, "__url__"):
65 text.append("URL: ", style="dim")
66 text.append(f"{ezpl.__url__}\n", style="white")
68 panel = Panel(
69 text,
70 title="[bold bright_blue]Version Information[/bold bright_blue]",
71 border_style="bright_blue",
72 padding=(1, 2),
73 )
74 console.print(panel)
75 else:
76 # Simple version
77 console.print(
78 f"[bold bright_blue]Ezpl[/bold bright_blue] v[bold green]{version}[/bold green]"
79 )