From 7ad1d0e0af695fa7f872b740a1bb7b2897eb41bd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 11 May 2023 11:25:01 +0200 Subject: Adding upstream version 0.8.1. Signed-off-by: Daniel Baumann --- eos_downloader/cli/cli.py | 76 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 eos_downloader/cli/cli.py (limited to 'eos_downloader/cli/cli.py') diff --git a/eos_downloader/cli/cli.py b/eos_downloader/cli/cli.py new file mode 100644 index 0000000..ddd0dea --- /dev/null +++ b/eos_downloader/cli/cli.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# coding: utf-8 -*- +# pylint: disable=no-value-for-parameter +# pylint: disable=cyclic-import +# pylint: disable=too-many-arguments +# pylint: disable=unused-argument + + +""" +ARDL CLI Baseline. +""" + +import click +from rich.console import Console +import eos_downloader +from eos_downloader.cli.get import commands as get_commands +from eos_downloader.cli.debug import commands as debug_commands +from eos_downloader.cli.info import commands as info_commands + + +@click.group() +@click.pass_context +@click.option('--token', show_envvar=True, default=None, help='Arista Token from your customer account') +def ardl(ctx: click.Context, token: str) -> None: + """Arista Network Download CLI""" + ctx.ensure_object(dict) + 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(no_args_is_help=True) +@click.pass_context +def get(ctx: click.Context) -> None: + # pylint: disable=redefined-builtin + """Download Arista from Arista website""" + + +@ardl.group(no_args_is_help=True) +@click.pass_context +def info(ctx: click.Context) -> None: + # pylint: disable=redefined-builtin + """List information from Arista website""" + + +@ardl.group(no_args_is_help=True) +@click.pass_context +def debug(ctx: click.Context) -> None: + # pylint: disable=redefined-builtin + """Debug commands to work with ardl""" + +# ANTA CLI Execution + + +def cli() -> None: + """Load ANTA CLI""" + # Load group commands + get.add_command(get_commands.eos) + 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' + ) + + +if __name__ == '__main__': + cli() -- cgit v1.2.3