1"""
2Main entry points for the package.
3"""
4
5import sys
6
7
8def main(): # Will be used as entry-point in pyproject.toml
9 """
10 Main function of the package.
11
12 Read arguments from `sys.argv[1:]`.
13
14 .. Note:: Will be used as `pyyc` entry-point in :ref:`pyproject.toml`,
15 and in the `__main__` block (`python -m pyyc`).
16 """
17
18 print("Command line arguments:", sys.argv[1:])
19
20
21def main_addition():
22 """
23 Another entry point of the package.
24
25 Read arguments from `sys.argv[1:]`.
26
27 .. Note:: Will be used as `pyyc_addition` entry-point
28 in :ref:`pyproject.toml`.
29 """
30
31 try:
32 iargs = [int(arg) for arg in sys.argv[1:]]
33 except ValueError:
34 print("Only integers accepted as command-line arguments, got", sys.argv[1:])
35 return
36
37 if len(iargs) < 2:
38 print("At least two arguments on command line, got", len(sys.argv[1:]))
39 return
40
41 print(" + ".join([str(arg) for arg in iargs]), "=", sum(iargs))
42
43
44if __name__ == "__main__": # Will be used by `python -m pyyc`
45
46 main()