From: garciadeblas Date: Tue, 22 Sep 2020 07:23:32 +0000 (+0000) Subject: Added --filter option to command vim-show X-Git-Tag: release-v9.0-start~16 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=db09ff0a44484d0d16769130e817dc24010c4070;p=osm%2Fosmclient.git Added --filter option to command vim-show Fixes bug 1227 Change-Id: Ia6a314cd098d9d8fe5f0d19783cb59f69555c5a0 Signed-off-by: garciadeblas --- diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 2cca98d..d71eaaa 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -2597,8 +2597,10 @@ def vim_list(ctx, filter, long): @cli_osm.command(name='vim-show', short_help='shows the details of a VIM account') @click.argument('name') +@click.option('--filter', multiple=True, + help='restricts the information to the fields in the filter') @click.pass_context -def vim_show(ctx, name): +def vim_show(ctx, name, filter): """shows the details of a VIM account NAME: name or ID of the VIM account @@ -2614,7 +2616,8 @@ def vim_show(ctx, name): table = PrettyTable(['key', 'attribute']) for k, v in list(resp.items()): - table.add_row([k, wrap_text(text=json.dumps(v, indent=2),width=100)]) + if not filter or k in filter: + table.add_row([k, wrap_text(text=json.dumps(v, indent=2),width=100)]) table.align = 'l' print(table)