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