2022-03-30 18:00:11 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
# IMPORTS
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
import os;
|
2022-06-10 11:50:59 +02:00
|
|
|
import sys
|
2022-03-30 18:00:11 +02:00
|
|
|
|
2022-06-10 11:50:59 +02:00
|
|
|
os.chdir(os.path.join(os.path.dirname(__file__)));
|
2022-03-30 18:00:11 +02:00
|
|
|
sys.path.insert(0, os.getcwd());
|
|
|
|
|
2022-06-11 14:00:45 +02:00
|
|
|
from src.models.config import *;
|
|
|
|
from src.core import log;
|
|
|
|
from src.setup import config;
|
|
|
|
from src import api;
|
2022-03-30 18:00:11 +02:00
|
|
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
# MAIN METHOD
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2022-06-11 14:00:45 +02:00
|
|
|
def enter(*args: str):
|
|
|
|
# set logging level:
|
|
|
|
log.configure_logging(config.LOG_LEVEL);
|
|
|
|
|
|
|
|
# process inputs:
|
|
|
|
if len(args) == 0:
|
|
|
|
# Führe befehle in Assets aus:
|
|
|
|
for command in config.COMMANDS:
|
|
|
|
result = api.run_command(command);
|
2022-06-11 14:07:00 +02:00
|
|
|
# ignored if log-level >> DEBUG
|
|
|
|
log.log_result(result, debug=True);
|
2022-06-11 14:00:45 +02:00
|
|
|
else:
|
|
|
|
# Führe CLI-Befehl aus:
|
|
|
|
result = api.run_command_from_json(args[0]);
|
2022-06-11 14:07:00 +02:00
|
|
|
# ignored if log-level >> DEBUG
|
|
|
|
log.log_result(result, debug=True);
|
2022-03-30 18:00:11 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
# EXECUTION
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2022-06-11 14:00:45 +02:00
|
|
|
sys.tracebacklimit = 0;
|
|
|
|
enter(*sys.argv[1:]);
|