diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-02-23 16:40:32 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-02-23 16:40:32 +0800 |
commit | 7e54b1ebe280d760347b1b640c9d4d0038ca6c58 (patch) | |
tree | 4d42c7a84066f0c2ae320e32dc7d86072fd0e4ae /python/cru/service/__main__.py | |
parent | 34704b2090c48d9ab9e7458475fd701a38706ae7 (diff) | |
download | crupest-7e54b1ebe280d760347b1b640c9d4d0038ca6c58.tar.gz crupest-7e54b1ebe280d760347b1b640c9d4d0038ca6c58.tar.bz2 crupest-7e54b1ebe280d760347b1b640c9d4d0038ca6c58.zip |
feat(python): move python codes.
Diffstat (limited to 'python/cru/service/__main__.py')
-rw-r--r-- | python/cru/service/__main__.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/python/cru/service/__main__.py b/python/cru/service/__main__.py new file mode 100644 index 0000000..2a0268b --- /dev/null +++ b/python/cru/service/__main__.py @@ -0,0 +1,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 |