31 lines
615 B
Python
31 lines
615 B
Python
import argparse
|
|
|
|
from cli import role
|
|
|
|
parser = argparse.ArgumentParser()
|
|
subparsers = parser.add_subparsers(dest="role")
|
|
|
|
role.admin.load_parse(subparsers)
|
|
role.client.load_parse(subparsers)
|
|
role.machine.load_parse(subparsers)
|
|
|
|
|
|
arguments = parser.parse_args()
|
|
|
|
|
|
if not arguments:
|
|
parser.print_help()
|
|
exit(1)
|
|
|
|
|
|
match arguments.role:
|
|
case "admin":
|
|
role.admin.run(parser, arguments)
|
|
case "machine":
|
|
role.machine.run(parser, arguments)
|
|
case "client":
|
|
role.client.run(parser, arguments)
|
|
|
|
# if the role is unknown, show the usage
|
|
case _:
|
|
parser.print_usage()
|