Skip to content

validator_factory

trestle.core.validator_factory ¤

Register all validators here in the validator_factory.

Attributes¤

validator_factory: ObjectFactory = ObjectFactory() module-attribute ¤

Classes¤

Functions¤

init_arguments(cmd) ¤

Feed the arguments to the argument parser.

Source code in trestle/core/validator_factory.py
36
37
38
39
40
41
42
43
44
def init_arguments(cmd: Command) -> None:
    """Feed the arguments to the argument parser."""
    group = cmd.parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-f', '--file', help='Path of file in trestle directory to validate.')
    group.add_argument('-t', '--type', choices=const.MODEL_TYPE_LIST, help='Validate one or all models of this type.')
    group.add_argument('-a', '--all', action='store_true', help='Validate all models in trestle directory.')
    cmd.add_argument('-n', '--name', help='Name of single model to validate (with --type specified).', required=False)
    quiet_help = 'Do not report messages unless validation fails.'
    cmd.add_argument('-q', '--quiet', action='store_true', help=quiet_help, required=False)

handler: python