logger = logging.getLogger("osmclient")
-def vnf_list(ctx, ns, filter, long, o):
+def vnf_list(ctx, ns, filter, long, output):
logger.debug("")
if ns or filter:
if ns:
vnfr["config-status"],
]
)
- 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="vnf-list", short_help="list all NF instances")
help="restricts the list to the NF instances matching the filter.",
)
@click.option("--long", is_flag=True, help="get more details")
-@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 vnf_list1(ctx, ns, filter, long, o):
+def vnf_list1(ctx, ns, filter, long, output):
"""list all NF instances"""
logger.debug("")
- vnf_list(ctx, ns, filter, long, o)
+ vnf_list(ctx, ns, filter, long, output)
@click.command(name="nf-list", short_help="list all NF instances")
help="restricts the list to the NF instances matching the filter.",
)
@click.option("--long", is_flag=True, help="get more details")
-@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 nf_list(ctx, ns, filter, long, o):
+def nf_list(ctx, ns, filter, long, output):
"""list all NF instances
\b
--filter vnfd-ref=<VNFD_NAME>,vdur.ip-address=<IP_ADDRESS>
"""
logger.debug("")
- vnf_list(ctx, ns, filter, long, o)
+ vnf_list(ctx, ns, filter, long, output)
@click.command(name="vnf-show", short_help="shows the info of a VNF instance")
help="restricts the information to the fields in the filter",
)
@click.option("--kdu", default=None, help="KDU name (whose status will be shown)")
-@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 vnf_show(ctx, name, literal, filter, kdu, o):
+def vnf_show(ctx, name, literal, filter, kdu, output):
"""shows the info of a VNF instance
NAME: name or ID of the VNF instance
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)