From f5dcf8133438cab8df25d3f00ad06ab2539e1cae Mon Sep 17 00:00:00 2001 From: up-n-atom Date: Tue, 14 Nov 2023 19:56:43 -0500 Subject: [PATCH] Support multiple paths for get-value --- xmo-remote-client.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/xmo-remote-client.py b/xmo-remote-client.py index ffb8d2c..bf4d003 100755 --- a/xmo-remote-client.py +++ b/xmo-remote-client.py @@ -49,19 +49,20 @@ async def cli(ctx: click.Context, host: str, username: str, password: str, authe @cli.command() -@click.option('--path', required=True) +@click.option('--path', required=True, multiple=True) @click.pass_context async def get_value(ctx: click.Context, path: str) -> None: client = ctx.find_object(SagemcomClient) if client is None: return - try: - value = await client.get_value_by_xpath(path) - except Exception as e: - click.echo(e, err=True) - raise click.Abort() - else: - click.echo(json.dumps(value, indent=2)) + for _path in path: + try: + value = await client.get_value_by_xpath(_path) + except Exception as e: + click.echo(e, err=True) + raise click.Abort() + else: + click.echo(json.dumps(value, indent=2)) @cli.command()