aboutsummaryrefslogtreecommitdiff
path: root/python/cru/service/__main__.py
blob: 2a0268b4b457fbd95e19f7291fcc7711eaba0fb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sys

from cru import CruException

from ._app import create_app


def main():
    app = create_app()
    app.run_command()


if __name__ == "__main__":
    version_info = sys.version_info
    if not (version_info.major == 3 and version_info.minor >= 11):
        print("This application requires Python 3.11 or later.", file=sys.stderr)
        sys.exit(1)

    try:
        main()
    except CruException as e:
        user_message = e.get_user_message()
        if user_message is not None:
            print(f"Error: {user_message}")
            exit(1)
        else:
            raise