generated from Luis/nextjs-python-web-template
clan-cli: restructure according to python's module standard
This commit is contained in:
@@ -8,19 +8,21 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
has_argcomplete = False
|
has_argcomplete = False
|
||||||
|
|
||||||
import clan_admin
|
from . import admin
|
||||||
|
|
||||||
|
|
||||||
# this will be the entrypoint under /bin/clan (see pyproject.toml config)
|
# this will be the entrypoint under /bin/clan (see pyproject.toml config)
|
||||||
def clan() -> None:
|
def main() -> None:
|
||||||
parser = argparse.ArgumentParser(description="cLAN tool")
|
parser = argparse.ArgumentParser(description="cLAN tool")
|
||||||
subparsers = parser.add_subparsers()
|
subparsers = parser.add_subparsers()
|
||||||
|
|
||||||
# init clan admin
|
|
||||||
parser_admin = subparsers.add_parser("admin")
|
parser_admin = subparsers.add_parser("admin")
|
||||||
clan_admin.make_parser(parser_admin)
|
admin.register_parser(parser_admin)
|
||||||
if has_argcomplete:
|
if has_argcomplete:
|
||||||
argcomplete.autocomplete(parser)
|
argcomplete.autocomplete(parser)
|
||||||
parser.parse_args()
|
parser.parse_args()
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -70,7 +70,7 @@ def git(args: argparse.Namespace) -> None: # pragma: no cover
|
|||||||
)
|
)
|
||||||
|
|
||||||
# takes a (sub)parser and configures it
|
# takes a (sub)parser and configures it
|
||||||
def make_parser(parser: argparse.ArgumentParser) -> None:
|
def register_parser(parser: argparse.ArgumentParser) -> None:
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-f",
|
"-f",
|
||||||
"--folder",
|
"--folder",
|
||||||
@@ -2,14 +2,11 @@
|
|||||||
requires = ["setuptools"]
|
requires = ["setuptools"]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
|
||||||
include = ["clan.py"]
|
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "clan"
|
name = "clan"
|
||||||
description = "cLAN CLI tool"
|
description = "cLAN CLI tool"
|
||||||
dynamic = ["version"]
|
dynamic = ["version"]
|
||||||
scripts = {clan = "clan:clan"}
|
scripts = {clan = "clan_cli:main"}
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
addopts = "--cov . --cov-report term --cov-fail-under=100 --no-cov-on-fail"
|
addopts = "--cov . --cov-report term --cov-fail-under=100 --no-cov-on-fail"
|
||||||
|
|||||||
Reference in New Issue
Block a user