Coverage for src / ezqt_widgets / cli / commands / _version.py: 0.00%

25 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-01 22:46 +0000

1# /////////////////////////////////////////////////////////////// 

2# EZQT_WIDGETS - CLI Version Command 

3# Project: ezqt_widgets 

4# /////////////////////////////////////////////////////////////// 

5 

6""" 

7CLI command for displaying version information. 

8 

9This module provides the version command for EzQt-Widgets. 

10""" 

11 

12from __future__ import annotations 

13 

14# /////////////////////////////////////////////////////////////// 

15# IMPORTS 

16# /////////////////////////////////////////////////////////////// 

17# Third-party imports 

18import click 

19from rich.panel import Panel 

20from rich.text import Text 

21 

22# Local imports 

23import ezqt_widgets 

24 

25from .._console import console 

26 

27# /////////////////////////////////////////////////////////////// 

28# COMMANDS 

29# /////////////////////////////////////////////////////////////// 

30 

31 

32@click.command(name="version", help="Display version information") 

33@click.option( 

34 "--full", 

35 "-f", 

36 is_flag=True, 

37 help="Display full version information", 

38) 

39def version_command(full: bool) -> None: 

40 """ 

41 Display version information. 

42 

43 Show the current version of Ezpl. 

44 Use --full for detailed version information. 

45 """ 

46 version = getattr(ezqt_widgets, "__version__", "unknown") 

47 author = getattr(ezqt_widgets, "__author__", "unknown") 

48 

49 if full: 

50 # Full version info 

51 text = Text() 

52 text.append("Ezpl ", style="bold bright_blue") 

53 text.append(f"v{version}", style="bold green") 

54 text.append("\n\n", style="reset") 

55 

56 text.append("Author: ", style="dim") 

57 text.append(f"{author}\n", style="white") 

58 

59 url = getattr(ezqt_widgets, "__url__", None) 

60 if url: 

61 text.append("URL: ", style="dim") 

62 text.append(f"{url}\n", style="white") 

63 

64 panel = Panel( 

65 text, 

66 title="[bold bright_blue]Version Information[/bold bright_blue]", 

67 border_style="bright_blue", 

68 padding=(1, 2), 

69 ) 

70 console.print(panel) 

71 else: 

72 # Simple version 

73 console.print( 

74 f"[bold bright_blue]Ezpl[/bold bright_blue] v[bold green]{version}[/bold green]" 

75 )