Compare commits

...

2 Commits

10 changed files with 37 additions and 31 deletions

View File

@ -3,7 +3,7 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PATH_TO_ARTEFACT:=../../dist/ads
PATH_TO_CONFIG:=../config.yml
COLOUR:=false
COLOUR:=true# <- auf false stellen, falls es Probleme gibt
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# TARGETS
@ -13,9 +13,9 @@ setup:
build:
go build -o ${PATH_TO_ARTEFACT} main.go
run: # non-interactive mode mit config-datei
${PATH_TO_ARTEFACT} run --debug --colour COLOUR --config "${PATH_TO_CONFIG}"
${PATH_TO_ARTEFACT} run --debug --colour ${COLOUR} --config "${PATH_TO_CONFIG}"
run-it: # interactive mode
${PATH_TO_ARTEFACT} run --it --debug --colour COLOUR
${PATH_TO_ARTEFACT} run --it --debug --colour ${COLOUR}
# Do everything:
all: setup build run
all-it: setup build run-it

View File

@ -9,7 +9,7 @@ package logging
* ---------------------------------------------------------------- */
var quietmode bool = false
var debugmode bool = false
var debugmode bool = true
var ansimode bool = false
var loggingPrefix string = ""
var force bool = false

View File

@ -29,7 +29,7 @@ import (
func RunInteractive() error {
logging.Plain(setup.Logo())
_, err := menuMain.ShowMenu()
logging.Info("Programm terminiert.")
logging.Plain("\033[2;3m...Programm terminiert.\033[0m")
return err
}

View File

@ -78,7 +78,7 @@ var menuDebugMode = menus.Menu{
{Label: "aus", Action: actionDebugModeOff},
},
},
Default: 1,
Default: 0,
}
var menuPrePostChecking = menus.Menu{

View File

@ -37,13 +37,13 @@ var optionsChecks = argparse.Options{
}
var optionsDebug = argparse.Options{
Help: "Blendet die Debugging-Befehle ein.",
Help: "Blendet Debugging-Befehle ein.",
Required: false,
Default: false,
}
var optionsInteractive = argparse.Options{
Help: "Startet die App im interaktiven Modus.",
Help: "Startet das Programm im interaktiven Modus.",
Required: false,
Default: false,
}

View File

@ -56,12 +56,10 @@ func main() {
// initialisiere basic optionen wie Logging
showChecks = false
if err == nil {
quiet := arguments.QuietModeOn()
if arguments.InteractiveMode() {
quiet = false
if !(arguments.ModeRun.Happened() && arguments.InteractiveMode()) {
logging.SetQuietMode(arguments.QuietModeOn())
logging.SetDebugMode(arguments.DebugModeOn())
}
logging.SetQuietMode(quiet)
logging.SetDebugMode(arguments.DebugModeOn())
logging.SetAnsiMode(arguments.ShowColour())
showChecks = arguments.ShowChecks()
}
@ -73,22 +71,26 @@ func main() {
if err == nil {
if arguments.ModeVersion.Happened() {
endpoints_print.Version()
return
} else if arguments.ModeRun.Happened() {
if arguments.InteractiveMode() {
err = endpoints_run.RunInteractive()
endpoints_run.RunInteractive()
} else {
err = endpoints_run.RunNonInteractive(arguments.GetConfigFile())
if err != nil {
logging.Fatal(err)
}
}
return
} else if arguments.ModeHelp.Happened() {
endpoints_print.Help()
return
} else {
err = endpoints_run.RunInteractive()
endpoints_run.RunInteractive()
}
} else if cmdMissing {
err = endpoints_run.RunInteractive()
}
if err != nil {
endpoints_run.RunInteractive()
} else {
logging.Fatal(err)
}
}

View File

@ -2,22 +2,25 @@
# LOCAL ARGUMENTS
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PATH_TO_CONFIG:=../config.yml
COLOUR:=false
COLOUR:=true# <- auf false stellen, falls es Probleme gibt
ifeq ($(OS),Windows_NT)
PYTHON:="py -3"
PYTHON:=py -3
PIP:=py -3 -m pip
else
PYTHON:="python3"
PYTHON:=python3
PIP:=python3 -m pip
endif
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# TARGETS
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
setup:
${PYTHON} -m pip install -r requirements;
setup: # TODO: Variant mit venv
${PIP} install -r requirements;
run: # non-interactive mode mit config-datei
${PYTHON} src/main.py run --debug --colour COLOUR --config "${PATH_TO_CONFIG}"
${PYTHON} src/main.py run --debug --colour ${COLOUR} --config "${PATH_TO_CONFIG}"
run-it: # interactive mode
${PYTHON} src/main.py run --it --debug --colour COLOUR
${PYTHON} src/main.py run --it --debug --colour ${COLOUR}
# Do everything:
all: setup run
all-it: setup run-it

View File

@ -18,7 +18,7 @@ from src.core.utils import StripAnsi;
_logging_prefix: str = '';
_quietmode: bool = False;
_debugmode: bool = False;
_debugmode: bool = True;
_ansimode: bool = False;
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -38,8 +38,9 @@ def enter(
colour: bool,
config: Any, **_
):
SetQuietMode(quiet);
SetDebugMode(debug);
if not (mode == 'run' and it):
SetQuietMode(quiet);
SetDebugMode(debug);
SetAnsiMode(colour);
appconfig.SetAppConfigPerformChecks(checks);

View File

@ -41,9 +41,9 @@ def GetArgumentParser() -> argparse.ArgumentParser:
run = Algorithmen ausführen.
'''),
);
parser.add_argument('--it', action='store_true', help='Startet die App im interaktiven Modus.')
parser.add_argument('--it', action='store_true', help='Startet das Programm im interaktiven Modus.')
parser.add_argument('-q', '--quiet', action='store_true', help='Blendet alle Konsole-Messages aus.')
parser.add_argument('--debug', action='store_true', help='Blendet die Debugging-Befehle ein.')
parser.add_argument('--debug', action='store_true', help='Blendet Debugging-Befehle ein.')
parser.add_argument('--checks', nargs=1, type=str, default=['False'],
help=DedentIgnoreFirstLast('''
(bool) Ob vor und nach Ausführung von Algorithmen Checks