Support multiple paths for get-value

This commit is contained in:
up-n-atom
2023-11-14 19:56:43 -05:00
committed by GitHub
parent 4f25dd6cc7
commit f5dcf81334
+3 -2
View File
@@ -49,14 +49,15 @@ async def cli(ctx: click.Context, host: str, username: str, password: str, authe
@cli.command() @cli.command()
@click.option('--path', required=True) @click.option('--path', required=True, multiple=True)
@click.pass_context @click.pass_context
async def get_value(ctx: click.Context, path: str) -> None: async def get_value(ctx: click.Context, path: str) -> None:
client = ctx.find_object(SagemcomClient) client = ctx.find_object(SagemcomClient)
if client is None: if client is None:
return return
for _path in path:
try: try:
value = await client.get_value_by_xpath(path) value = await client.get_value_by_xpath(_path)
except Exception as e: except Exception as e:
click.echo(e, err=True) click.echo(e, err=True)
raise click.Abort() raise click.Abort()