Source code for uac_cli.utils.options

import click

from uac_cli.utils.config import get_default_view

output_option = click.option("--output", "-o", type=click.File("w"))
output_option_binary = click.option(
    "--output", "-o", type=click.File("wb", encoding="utf-16")
)
select_option = click.option(
    "--select", "-s", help="select which field to be returned. JSONPATH"
)
input_option = click.option("--input", "-i", type=click.File("r"), required=True)
input_option_binary = click.option(
    "--input", "-i", type=click.File("rb", encoding="utf-16"), required=True
)


[docs]def _parse_table_format(ctx, param, value): if value == "table": return True if value == "json": return False return get_default_view() == "table"
table_option = click.option( "--format", "-f", "table", # kwarg name passed to the decorated function type=click.Choice(["json", "table"], case_sensitive=False), default=None, show_default=False, help="Output format (json or table). Defaults to output_options.default_stdout_format in config.yml.", callback=_parse_table_format, ) table_fields_option = click.option( "--columns", "-c", "table_fields", # kwarg name passed to the decorated function help="Comma-separated list of field names to display in table output. Supports dot notation for nested fields (e.g. name.label). Example: name,description,type", )