|
1 | | -import argparse # pragma: no cover |
2 | | - |
3 | | -from . import BaseClass, base_function # pragma: no cover |
4 | | - |
5 | | - |
6 | | -def main() -> None: # pragma: no cover |
7 | | - """ |
8 | | - The main function executes on commands: |
9 | | - `python -m project_name` and `$ project_name `. |
10 | | -
|
11 | | - This is your program's entry point. |
12 | | -
|
13 | | - You can change this function to do whatever you want. |
14 | | - Examples: |
15 | | - * Run a test suite |
16 | | - * Run a server |
17 | | - * Do some other stuff |
18 | | - * Run a command line application (Click, Typer, ArgParse) |
19 | | - * List all available tasks |
20 | | - * Run an application (Flask, FastAPI, Django, etc.) |
21 | | - """ |
22 | | - parser = argparse.ArgumentParser( |
23 | | - description="project_name.", |
24 | | - epilog="Enjoy the project_name functionality!", |
25 | | - ) |
26 | | - # This is required positional argument |
27 | | - parser.add_argument( |
28 | | - "name", |
29 | | - type=str, |
30 | | - help="The username", |
31 | | - default="author_name", |
32 | | - ) |
33 | | - # This is optional named argument |
34 | | - parser.add_argument( |
35 | | - "-m", |
36 | | - "--message", |
37 | | - type=str, |
38 | | - help="The Message", |
39 | | - default="Hello", |
40 | | - required=False, |
41 | | - ) |
42 | | - parser.add_argument( |
43 | | - "-v", |
44 | | - "--verbose", |
45 | | - action="store_true", |
46 | | - help="Optionally adds verbosity", |
47 | | - ) |
48 | | - args = parser.parse_args() |
49 | | - print(f"{args.message} {args.name}!") |
50 | | - if args.verbose: |
51 | | - print("Verbose mode is on.") |
52 | | - |
53 | | - print("Executing main function") |
54 | | - base = BaseClass() |
55 | | - print(base.base_method()) |
56 | | - print(base_function()) |
57 | | - print("End of main function") |
| 1 | +"""Entry point for project_name.""" |
58 | 2 |
|
| 3 | +from .cli import main # pragma: no cover |
59 | 4 |
|
60 | 5 | if __name__ == "__main__": # pragma: no cover |
61 | 6 | main() |
0 commit comments