Merge pull request 'templates: add python-project' (#10) from python-template into main

This commit is contained in:
DavHau
2023-07-20 17:32:28 +02:00
committed by Gitea
parent cadfb90bd3
commit eaaf0d2992
12 changed files with 248 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import argparse
# statement that doesn't need testing
__version__ = "1.0.0" # pragma: no cover
# this will be an entrypoint under /bin/my_cli (see pyproject.toml config)
def my_cli() -> None:
parser = argparse.ArgumentParser(description="my-tool")
parser.add_argument(
"-v", "--version", help="Show the version of this program", action="store_true"
)
args = parser.parse_args()
if args.version:
print(f"Version: {__version__}")
else:
parser.print_help()