add: new requirements add: default action for modules add: banner fix: set log level fix: cmd boolean args handler fix: log messages fix: metavar: __name__ -> __tool_name__
56 lines
1.3 KiB
Python
56 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
This file contains API calls and Data
|
|
"""
|
|
|
|
import six
|
|
import logging
|
|
|
|
from .data import *
|
|
|
|
__all__ = ["run_console", "run", "GlobalParameters"]
|
|
|
|
log = logging.getLogger()
|
|
|
|
|
|
# --------------------------------------------------------------------------
|
|
#
|
|
# Command line options
|
|
#
|
|
# --------------------------------------------------------------------------
|
|
def run_console(config):
|
|
"""
|
|
:param config: GlobalParameters option instance
|
|
:type config: `GlobalParameters`
|
|
|
|
:raises: TypeError
|
|
"""
|
|
if not isinstance(config, GlobalExecutionParameters):
|
|
raise TypeError("Expected GlobalParameters, got '%s' instead" % type(config))
|
|
|
|
logging.error("Starting Enteletaor execution")
|
|
run(config)
|
|
logging.error("Done!")
|
|
|
|
|
|
# ----------------------------------------------------------------------
|
|
#
|
|
# API call
|
|
#
|
|
# ----------------------------------------------------------------------
|
|
def run(config):
|
|
"""
|
|
:param config: GlobalParameters option instance
|
|
:type config: `GlobalParameters`
|
|
|
|
:raises: TypeError
|
|
"""
|
|
if not isinstance(config, GlobalExecutionParameters):
|
|
raise TypeError("Expected GlobalParameters, got '%s' instead" % type(config))
|
|
|
|
from .libs.core.structs import AppSettings
|
|
|
|
# Run modules
|
|
AppSettings.modules[config.action]().run(config)
|