/
main.py
50 lines (41 loc) · 1.2 KB
/
main.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Copyright (c) 2024 JP Hutchins
# SPDX-License-Identifier: Apache-2.0
"""The application entry point."""
import argparse
from importlib.metadata import version
from typing import Final
def app() -> None:
"""The application entry point."""
parser: Final = argparse.ArgumentParser(
description=(
f"Python distribution example application "
f"v{version('jpsapp')}\n"
"\n"
"Copyright (c) 2024 JP Hutchins\n"
"SPDX-License-Identifier: Apache-2.0\n"
"\n"
"https://github.com/JPHutchins/python-distribution-example"
),
formatter_class=argparse.RawTextHelpFormatter,
)
parser.add_argument(
"-v",
"--version",
action="store_true",
default=False,
help="Display the version.",
)
parser.add_argument(
"-i",
"--input",
action="store_true",
default=False,
help="Await any key before exiting.",
)
args: Final = parser.parse_args()
if args.version is True:
print(version("jpsapp"))
raise SystemExit(0)
print("Hello, World!")
if args.input is True:
input("Press any key to exit...")