def validate_fields(command_context, param, value): valid = Display.valid_fields() possible = value.split(',') if value else [] for field in possible: if field not in valid: raise click.BadParameter( f'Field {field} is not a valid field! Use {",".join(valid)}') return possible
def validate_sort(command_context, param, value): if value and value not in Display.valid_fields(): raise click.BadParameter( f'Sort parameter {value} is not a valid field!') return value