clan-cli: restructure according to python's module standard
This commit is contained in:
28
pkgs/clan-cli/clan_cli/__init__.py
Executable file
28
pkgs/clan-cli/clan_cli/__init__.py
Executable file
@@ -0,0 +1,28 @@
|
||||
# !/usr/bin/env python3
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
has_argcomplete = True
|
||||
try:
|
||||
import argcomplete
|
||||
except ImportError:
|
||||
has_argcomplete = False
|
||||
|
||||
from . import admin
|
||||
|
||||
|
||||
# this will be the entrypoint under /bin/clan (see pyproject.toml config)
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description="cLAN tool")
|
||||
subparsers = parser.add_subparsers()
|
||||
|
||||
parser_admin = subparsers.add_parser("admin")
|
||||
admin.register_parser(parser_admin)
|
||||
if has_argcomplete:
|
||||
argcomplete.autocomplete(parser)
|
||||
parser.parse_args()
|
||||
if len(sys.argv) == 1:
|
||||
parser.print_help()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user