2020-08-04 14:52:30 +00:00
|
|
|
#!/usr/bin/env python3
|
2020-08-10 12:05:19 +00:00
|
|
|
import logging
|
|
|
|
|
2020-08-06 11:43:45 +00:00
|
|
|
import kiwi
|
2020-08-10 12:05:19 +00:00
|
|
|
from kiwi.subcommands import *
|
2020-08-04 14:52:30 +00:00
|
|
|
|
|
|
|
|
2020-08-06 12:34:25 +00:00
|
|
|
def main():
|
2020-08-10 12:05:19 +00:00
|
|
|
logging.basicConfig(
|
|
|
|
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
|
|
level=logging.NOTSET
|
|
|
|
)
|
|
|
|
|
|
|
|
commands = [
|
|
|
|
InitCommand,
|
|
|
|
ShowCommand,
|
|
|
|
LogsCommand
|
|
|
|
]
|
|
|
|
|
|
|
|
for cmd in commands:
|
|
|
|
cmd.setup()
|
|
|
|
|
|
|
|
args = kiwi.Parser.get_args()
|
|
|
|
|
|
|
|
if args.verbose >= 2:
|
|
|
|
log_level = logging.DEBUG
|
|
|
|
elif args.verbose >= 1:
|
|
|
|
log_level = logging.INFO
|
|
|
|
else:
|
|
|
|
log_level = logging.WARNING
|
|
|
|
|
|
|
|
logging.getLogger().setLevel(log_level)
|
|
|
|
|
|
|
|
for cmd in commands:
|
|
|
|
if cmd.command == args.command:
|
|
|
|
cmd.run()
|
|
|
|
return
|
2020-08-04 14:52:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|