refactor: streamline entry point and update version

Reorganized the script's main execution logic into a `main` function for clearer entry point definition and better maintainability. Updated the project version to 0.1.1, reflecting these changes alongside minor fixes. Adjusted the script reference in `pyproject.toml` to align with the new entry point structure, ensuring proper package execution as a console script. This refactor enhances code readability and supports more flexible future updates.
This commit is contained in:
Kumi 2024-05-03 15:11:25 +02:00
parent 3216df5bbb
commit 02d7441f38
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 6 additions and 4 deletions

View file

@ -7,7 +7,7 @@ allow-direct-references = true
[project]
name = "matrix-rssbot"
version = "0.1.0"
version = "0.1.1"
authors = [
{ name="Private.coffee Team", email="support@private.coffee" },
@ -41,7 +41,7 @@ dependencies = [
"Bug Tracker" = "https://git.private.coffee/PrivateCoffee/matrix-rssbot/issues"
[project.scripts]
rssbot = "matrix_rssbot:main"
rssbot = "matrix_rssbot.__main__:main"
[tool.hatch.build.targets.wheel]
packages = ["src/matrix_rssbot"]

View file

@ -18,8 +18,7 @@ def get_version():
return package_version
if __name__ == "__main__":
# Parse command line arguments
def main():
parser = ArgumentParser()
parser.add_argument(
"--config",
@ -53,3 +52,6 @@ if __name__ == "__main__":
print("Received KeyboardInterrupt - exiting...")
except SystemExit:
print("Received SIGTERM - exiting...")
if __name__ == "__main__":
main()