add docport, update args
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import sys
|
||||
from config import Config#
|
||||
from config import Config
|
||||
__version__ = "0.1.0"
|
||||
__author__ = "Alexander Kirchner"
|
||||
__email__ = "alexander.kirchner@ph-freiburg.de"
|
||||
__license__ = "MIT"
|
||||
docport = 6543
|
||||
|
||||
|
||||
config = Config("config/settings.yaml")
|
||||
valid_args = ["--debug", "--log", "--no-backup", "--ic-logging", "--version", "-h"]
|
||||
valid_args = ["--debug", "--log", "--no-backup", "--ic-logging", "--version", "-h","--no-documentation"]
|
||||
|
||||
args_description = {
|
||||
"--debug": "Enable debug mode",
|
||||
@@ -15,13 +16,15 @@ args_description = {
|
||||
"--no-backup": "Disable database backup",
|
||||
"--ic-logging": "Enable icecream logging (not available in production)",
|
||||
"--version": "Show version",
|
||||
"-h": "Show help message and exit"
|
||||
"-h": "Show help message and exit",
|
||||
"--no-documentation": "Disable documentation server and shortcut"
|
||||
}
|
||||
|
||||
args = sys.argv[1:]
|
||||
if any(arg not in valid_args for arg in args):
|
||||
print("Invalid argument present")
|
||||
#sys.exit()
|
||||
print([arg for arg in args if arg not in valid_args])
|
||||
sys.exit()
|
||||
|
||||
def help():
|
||||
print("Ausleihsystem")
|
||||
@@ -30,7 +33,7 @@ def help():
|
||||
print("Valide Argumente:")
|
||||
print("args")
|
||||
print("--------")
|
||||
print("usage: main.py [-h] [--debug] [--log] [--no-backup] [--ic-logging] [--version]")
|
||||
print("usage: main.py [-h] [--debug] [--log] [--no-backup] [--ic-logging] [--version] [--no-documentation]")
|
||||
print("options:")
|
||||
for arg in valid_args:
|
||||
print(f"{arg} : {args_description[arg]}")
|
||||
@@ -47,6 +50,12 @@ if "--no-backup" in args:
|
||||
config.no_backup = True
|
||||
if "--ic-logging" in args:
|
||||
config.ic_logging = True
|
||||
if "--no-documentation" in args:
|
||||
config.documentation = False
|
||||
if "--version" in args:
|
||||
print(__version__)
|
||||
sys.exit()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user