Add command line support using scripts/generate.py

Ship a poetry script (package-exported executable command) from the
scripts/generate.py file.

Refactor the main into a function for entrypoint purposes
pull/132/head
Jb DOYON 5 years ago
parent b446cb5a2f
commit 62e01746a4

@ -24,3 +24,6 @@ isort = "^4.3"
[tool.black]
line-length = 120
[tool.poetry.scripts]
diagrams = 'scripts.generate:main'

@ -94,9 +94,11 @@ def generate(pvd: str) -> None:
apidoc = gen_apidoc(pvd, typ_paths)
make_apidoc(pvd, apidoc)
if __name__ == "__main__":
def main():
pvd = sys.argv[1]
if pvd not in cfg.PROVIDERS:
sys.exit()
generate(pvd)
if __name__ == "__main__":
main()

Loading…
Cancel
Save