aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyproject.toml6
-rw-r--r--reddit-nextcloud-importer/__init__.py0
-rw-r--r--reddit_nextcloud_importer/__init__.py (renamed from reddit-nextcloud-importer/__main__.py)2
-rw-r--r--reddit_nextcloud_importer/__main__.py6
4 files changed, 12 insertions, 2 deletions
diff --git a/pyproject.toml b/pyproject.toml
index 48967ff..adde93c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,7 +7,7 @@ repository = "https://git.sr.ht/~gabrielgio/reddit-nextcloud-importer"
description = "Reddit to Nextcloud importer"
authors = ["Gabriel Arakaki Giovanini <mail@gabielgio.me>"]
packages = [
- { include = "reddit-nextcloud-importer" }
+ { include = "reddit_nextcloud_importer" }
]
[tool.poetry.dependencies]
@@ -25,6 +25,10 @@ coverage = "^6.3.2"
pytest-mock = "^3.7.0"
pytest-cov = "^3.0.0"
+
+[tool.poetry.scripts]
+reddit-nextcloud-importer = "reddit_nextcloud_importer:main"
+
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
diff --git a/reddit-nextcloud-importer/__init__.py b/reddit-nextcloud-importer/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/reddit-nextcloud-importer/__init__.py
+++ /dev/null
diff --git a/reddit-nextcloud-importer/__main__.py b/reddit_nextcloud_importer/__init__.py
index abddfdd..6097ef4 100644
--- a/reddit-nextcloud-importer/__main__.py
+++ b/reddit_nextcloud_importer/__init__.py
@@ -100,7 +100,7 @@ def download(url) -> [str]:
return files
-if __name__ == "__main__":
+def main():
args = parser.parse_args()
level = levels.get(args.log_level.lower())
diff --git a/reddit_nextcloud_importer/__main__.py b/reddit_nextcloud_importer/__main__.py
new file mode 100644
index 0000000..8fe4a7f
--- /dev/null
+++ b/reddit_nextcloud_importer/__main__.py
@@ -0,0 +1,6 @@
+import sys
+
+import reddit_nextcloud_importer
+
+if __name__ == "__main__":
+ sys.exit(reddit_nextcloud_importer.main())