master > master: code - argparsing hinzugefügt
This commit is contained in:
parent
14fad54a57
commit
210a3c45eb
22
code/main.py
22
code/main.py
@ -10,20 +10,28 @@ import sys;
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
|
||||
|
||||
from code.local.io import *;
|
||||
|
||||
from code.core.log import setQuietMode;
|
||||
from code.search.exports import *;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# GLOBAL VARIABLES/CONSTANTS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
#
|
||||
parser: argparse.ArgumentParser;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# MAIN PROCESS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
def main():
|
||||
def enter(args: argparse.Namespace):
|
||||
setQuietMode(args.quiet);
|
||||
setQuietMode(args.debug);
|
||||
if args.all is not None:
|
||||
goThroughCases();
|
||||
else:
|
||||
parser.print_help();
|
||||
return;
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -46,4 +54,12 @@ def goThroughCases():
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if __name__ == '__main__':
|
||||
main();
|
||||
cli_args = sys.argv[1:];
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='code/main.py',
|
||||
description=r'Code-Projekt, um verschiedene Algorithmen aus dem Kurs auszutesten.'
|
||||
);
|
||||
parser.add_argument('all', nargs='?');
|
||||
parser.add_argument('--debug', action='store_true', help='Debugging Messages stummschalten.')
|
||||
parser.add_argument('-q', '--quiet', action='store_true', help='Alle console-messages bis auf Errors stummschalten.')
|
||||
enter(parser.parse_args(cli_args));
|
||||
|
Loading…
x
Reference in New Issue
Block a user