diff --git a/main.py b/main.py index cd9cfcc..6739686 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,4 @@ -from thu_learn_downloader.__main__ import run +from thu_learn_downloader.__main__ import app if __name__ == "__main__": - run() + app() diff --git a/poetry.lock b/poetry.lock index 25a13c3..00610a2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.4.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand. [[package]] name = "altgraph" @@ -314,19 +314,19 @@ [[package]] name = "platformdirs" -version = "3.1.1" +version = "3.2.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.1.1-py3-none-any.whl", hash = "sha256:e5986afb596e4bb5bde29a79ac9061aa955b94fca2399b7aaac4090860920dd8"}, - {file = "platformdirs-3.1.1.tar.gz", hash = "sha256:024996549ee88ec1a9aa99ff7f8fc819bb59e2c3477b410d90a16d32d6e707aa"}, + {file = "platformdirs-3.2.0-py3-none-any.whl", hash = "sha256:ebe11c0d7a805086e99506aa331612429a72ca7cd52a1f0d277dc4adc20cb10e"}, + {file = "platformdirs-3.2.0.tar.gz", hash = "sha256:d5b638ca397f25f979350ff789db335903d7ea010ab28903f57b27e1b16c2b08"}, ] [package.extras] docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.2.2)", "pytest (>=7.2.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] [[package]] name = "pygments" diff --git a/pyproject.toml b/pyproject.toml index 77a7bde..d196728 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,5 +28,5 @@ pyinstaller = "^5.8.0" [tool.poetry.scripts] -thu-learn-downloader = "thu_learn_downloader.__main__:run" -tld = "thu_learn_downloader.__main__:run" +thu-learn-downloader = "thu_learn_downloader.__main__:app" +tld = "thu_learn_downloader.__main__:app" diff --git a/thu_learn_downloader/__main__.py b/thu_learn_downloader/__main__.py index 1c2ceef..fe9fd1e 100644 --- a/thu_learn_downloader/__main__.py +++ b/thu_learn_downloader/__main__.py @@ -19,7 +19,10 @@ from .downloader import Downloader from .helper import Helper +app = typer.Typer(name="tld") + +@app.command(name="tld") def main( username: str = typer.Option("liqin20", "-u", "--username"), password: str = typer.Option( @@ -79,9 +82,5 @@ ) -def run() -> None: - typer.run(main) - - if __name__ == "__main__": - run() + app()