Coverage for src / ezplog / cli / commands / _version.py: 28.12%
28 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-30 19:43 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-30 19:43 +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 ezplog as 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 url = getattr(ezpl, "__url__", None)
65 if url:
66 text.append("URL: ", style="dim")
67 text.append(f"{url}\n", style="white")
69 panel = Panel(
70 text,
71 title="[bold bright_blue]Version Information[/bold bright_blue]",
72 border_style="bright_blue",
73 padding=(1, 2),
74 )
75 console.print(panel)
76 else:
77 # Simple version
78 console.print(
79 f"[bold bright_blue]Ezpl[/bold bright_blue] v[bold green]{version}[/bold green]"
80 )