Skip to content

Translations

Catalog a project's .veriphy/translations/: python -m veriphy.translations list or show <name>.

main(argv=None)

List the translation entries in force for the project, or show one.

Parameters:

Name Type Description Default
argv Sequence[str] | None

The command-line arguments, sys.argv[1:] when None.

None

Raises:

Type Description
SystemExit

With status 1 when show finds no entry of that name, and 2 on bad usage.

Source code in src/veriphy/translations/_catalog.py
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
def main(argv: Sequence[str] | None = None) -> None:
    """List the translation entries in force for the project, or show one.

    Args:
        argv: The command-line arguments, `sys.argv[1:]` when `None`.

    Raises:
        SystemExit: With status 1 when `show` finds no entry of that name, and 2 on bad usage.
    """
    args = _parser().parse_args(list(sys.argv[1:] if argv is None else argv))
    tables, errors = _sources(find_workspace_root(args.root), everything=args.all or args.command == 'show')
    for error in errors:
        sys.stderr.write(f'invalid: {error}\n')
    if args.command == 'list':
        sys.stdout.write(''.join(f'{line}\n' for line in _lines(tables)))
        return
    found = _find(tables, args.name)
    if found is None:
        sys.stderr.write(f"no translation entry for '{args.name}'\n")
        raise SystemExit(NOT_FOUND)
    sys.stdout.write(found)