def format_ik_list(output_format, ik_list): formatter_class = determine_format_class(output_format) if formatter_class is TableFormat: formatter = formatter_class(ik_headers, ik_row_processor) else: formatter = formatter_class() result = formatter.convert_list(ik_list) return result
def format_ik(output_format, infrastructure_key): formatter_class = determine_format_class(output_format) if formatter_class is TableFormat: formatter = formatter_class(ik_headers, ik_row_processor) else: formatter = formatter_class() result = formatter.convert_element(infrastructure_key) return result
def format_dl(output_format, deployment_location): formatter_class = determine_format_class(output_format) if formatter_class is TableFormat: formatter = formatter_class(dl_headers, dl_row_processor) else: formatter = formatter_class() result = formatter.convert_element(deployment_location) return result
def format_lifecycle_driver(output_format, lifecycle_driver): formatter_class = determine_format_class(output_format) if formatter_class is TableFormat: formatter = formatter_class(lifecycle_driver_headers, lifecycle_driver_row_processor) else: formatter = formatter_class() result = formatter.convert_element(lifecycle_driver) return result
def list(config, output_format): """List available environments""" ctl = ctlmgmt.get_ctl(config) environments = [] if ctl.environments is not None: environments = __parse_envs_to_list(ctl.environments) formatter_class = determine_format_class(output_format) if formatter_class is TableFormat: formatter = formatter_class(env_headers, env_row_processor) else: formatter = formatter_class() result = formatter.convert_list(environments) click.echo(result)
def format_inspection_report(output_format, inspection_report): inspection_report_tpl = inspection_report.to_dict() formatter_class = determine_format_class(output_format) formatter = formatter_class() result = formatter.convert_element(inspection_report_tpl) return result