X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fosmclient.git;a=blobdiff_plain;f=osmclient%2Fcli_commands%2Fvim.py;fp=osmclient%2Fcli_commands%2Fvim.py;h=d74ea7b56a90b697ec07be28169539b16b6902aa;hp=b2a073dc7cafd4e3effe490bf20d12f58c96b3b8;hb=cd7cd5eba8cfbb5f1941744ff90cf45e0ebcf422;hpb=0e2d832d6e4099b7d2f868f9ee5a782b5fca2a56 diff --git a/osmclient/cli_commands/vim.py b/osmclient/cli_commands/vim.py index b2a073d..d74ea7b 100755 --- a/osmclient/cli_commands/vim.py +++ b/osmclient/cli_commands/vim.py @@ -304,15 +304,9 @@ def vim_delete(ctx, name, force, wait): is_flag=True, help="get more details of the NS (project, vim, deployment status, configuration status.", ) -@click.option( - "-o", - default="table", - is_eager=True, - callback=print_output.validate_command_output, - help="get more details of the NS (project, vim, deployment status, configuration status.", -) +@print_output.output_option @click.pass_context -def vim_list(ctx, filter, long, o): +def vim_list(ctx, filter, long, output): """list all VIM accounts""" logger.debug("") if filter: @@ -355,9 +349,7 @@ def vim_list(ctx, filter, long, o): table.add_row( [vim["name"], vim["uuid"], vim["_admin"].get("operationalState", "-")] ) - table.align = "l" - # print(table) - print_output.print_output(o, table.field_names, table._rows) + print_output.print_output(output, table.field_names, table._rows) @click.command(name="vim-show", short_help="shows the details of a VIM account") @@ -368,15 +360,9 @@ def vim_list(ctx, filter, long, o): help="restricts the information to the fields in the filter", ) @click.option("--literal", is_flag=True, help="print literally, no pretty table") -@click.option( - "-o", - default="table", - is_eager=True, - callback=print_output.validate_command_output, - help="adapt the output as table, yaml, csv, json, jsonpath", -) +@print_output.output_option @click.pass_context -def vim_show(ctx, name, filter, literal, o): +def vim_show(ctx, name, filter, literal, output): """shows the details of a VIM account NAME: name or ID of the VIM account @@ -395,6 +381,4 @@ def vim_show(ctx, name, filter, literal, o): for k, v in list(resp.items()): if not filter or k in filter: table.add_row([k, utils.wrap_text(text=json.dumps(v, indent=2), width=100)]) - table.align = "l" - # print(table) - print_output.print_output(o, table.field_names, table._rows) + print_output.print_output(output, table.field_names, table._rows)