From 163b590d156b62f5237f8d28c361828369248bf4 Mon Sep 17 00:00:00 2001 From: Thomas Grimonet Date: Mon, 2 Oct 2023 15:34:22 +0200 Subject: [PATCH] fix(ardl.cli): Implement --version as standard cli --- README.md | 4 ++-- eos_downloader/cli/cli.py | 12 ++---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 09b7bba..0f81b8a 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Usage: ardl [OPTIONS] COMMAND [ARGS]... Arista Network Download CLI Options: + --version Show the version and exit. --token TEXT Arista Token from your customer account [env var: ARISTA_TOKEN] --help Show this message and exit. @@ -35,7 +36,6 @@ Options: Commands: debug Debug commands to work with ardl get Download Arista from Arista website - version Display version of ardl ``` > **Warning** @@ -173,7 +173,7 @@ tqdm On EVE-NG, you may have to install/upgrade __pyOpenSSL__ in version `23.0.0`: -``` +```bash # Error when running ardl: AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK' $ pip install pyopenssl --upgrade diff --git a/eos_downloader/cli/cli.py b/eos_downloader/cli/cli.py index 17346d2..ad77f2b 100644 --- a/eos_downloader/cli/cli.py +++ b/eos_downloader/cli/cli.py @@ -11,9 +11,8 @@ """ import click -from rich.console import Console -import eos_downloader +from eos_downloader import __version__ from eos_downloader.cli.debug import commands as debug_commands from eos_downloader.cli.get import commands as get_commands from eos_downloader.cli.info import commands as info_commands @@ -22,6 +21,7 @@ @click.group(cls=AliasedGroup) +@click.version_option(__version__) @click.pass_context @click.option( "--token", @@ -35,13 +35,6 @@ def ardl(ctx: click.Context, token: str) -> None: ctx.obj["token"] = token -@click.command() -def version() -> None: - """Display version of ardl""" - console = Console() - console.print(f"ardl is running version {eos_downloader.__version__}") - - @ardl.group(cls=AliasedGroup, no_args_is_help=True) @click.pass_context def get(ctx: click.Context, cls: click.Group = AliasedGroup) -> None: @@ -73,7 +66,6 @@ def cli() -> None: get.add_command(get_commands.cvp) info.add_command(info_commands.eos_versions) debug.add_command(debug_commands.xml) - ardl.add_command(version) # Load CLI ardl(obj={}, auto_envvar_prefix="arista")