Skip to content

Commit

Permalink
cmd switched to custom suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ-Author committed Oct 21, 2024
1 parent 7ddd6b9 commit 7187620
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions ontologytimemachine/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,28 +104,30 @@ def parse_arguments(config_str: str = "") -> Config:
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)

help_suffix_template = "(default: %(default)s)"

# Defining ontoFormat argument with nested options
parser.add_argument(
"--ontoFormat",
type=lambda s: enum_parser(OntoFormat, s),
default=default_cfg.ontoFormatConf.format,
choices=list(OntoFormat),
help="Format of the ontology: turtle, ntriples, rdfxml, htmldocu. (default: %(default)s)",
help=f"Format of the ontology: turtle, ntriples, rdfxml, htmldocu. {help_suffix_template}",
)

parser.add_argument(
"--ontoPrecedence",
type=lambda s: enum_parser(OntoPrecedence, s),
default=default_cfg.ontoFormatConf.precedence,
choices=list(OntoPrecedence),
help="Precedence of the ontology: default, enforcedPriority, always. (default: %(default)s)",
help=f"Precedence of the ontology: default, enforcedPriority, always. {help_suffix_template}",
)

parser.add_argument(
"--patchAcceptUpstream",
action="store_true",
default=default_cfg.ontoFormatConf.patchAcceptUpstream,
help="Defines if the Accept Header is patched upstream in original mode. (default: %(default)s)",
help=f"Defines if the Accept Header is patched upstream in original mode. {help_suffix_template}",
)

# Defining ontoVersion argument
Expand All @@ -134,15 +136,15 @@ def parse_arguments(config_str: str = "") -> Config:
type=lambda s: enum_parser(OntoVersion, s),
default=default_cfg.ontoVersion,
choices=list(OntoVersion),
help="Version of the ontology: original, originalFailoverLive, originalFailoverArchivoMonitor, latestArchive, timestampArchive, dependencyManifest. (default: %(default)s)",
help=f"Version of the ontology: original, originalFailoverLive, originalFailoverArchivoMonitor, latestArchive, timestampArchive, dependencyManifest. {help_suffix_template}",
)

# Enable/disable mode to only proxy requests to ontologies
parser.add_argument(
"--restrictedAccess",
action="store_true",
default=default_cfg.restrictedAccess,
help="Enable/disable mode to only proxy requests to ontologies stored in Archivo. (default: %(default)s)",
help=f"Enable/disable mode to only proxy requests to ontologies stored in Archivo. {help_suffix_template}",
)

# Enable HTTPS interception for specific domains
Expand All @@ -151,23 +153,23 @@ def parse_arguments(config_str: str = "") -> Config:
type=lambda s: enum_parser(HttpsInterception, s),
default=default_cfg.httpsInterception,
choices=list(HttpsInterception),
help="Enable HTTPS interception for specific domains: none, archivo, all, listfilename. (default: %(default)s)",
help=f"Enable HTTPS interception for specific domains: none, archivo, all, listfilename. {help_suffix_template}",
)

# Enable/disable inspecting or removing redirects
parser.add_argument(
"--disableRemovingRedirects",
action="store_true",
default=default_cfg.disableRemovingRedirects,
help="Enable/disable inspecting or removing redirects. (default: %(default)s)",
help=f"Enable/disable inspecting or removing redirects. {help_suffix_template}",
)

parser.add_argument(
"--clientConfigViaProxyAuth",
type=lambda s: enum_parser(ClientConfigViaProxyAuth, s),
default=default_cfg.clientConfigViaProxyAuth,
choices=list(ClientConfigViaProxyAuth),
help="Define the configuration of the proxy via the proxy auth. (default: %(default)s)",
help=f"Define the configuration of the proxy via the proxy auth. {help_suffix_template}",
)

# Log level
Expand All @@ -176,24 +178,23 @@ def parse_arguments(config_str: str = "") -> Config:
type=lambda s: enum_parser(LogLevel, s),
default=default_cfg.logLevel,
choices=list(LogLevel),
help="Level of the logging: debug, info, warning, error. (default: %(default)s)",
help=f"Level of the logging: debug, info, warning, error. {help_suffix_template}",
)

# Host
parser.add_argument(
"--host",
type=str,
default=default_cfg.host,
help="Hostname or IP address to bind the proxy to. (default: %(default)s)",
help=f"Hostname or IP address to bind the proxy to. {help_suffix_template}",
)

# Port
parser.add_argument(
"--port",
type=int,
default=default_cfg.port,
help="port"
# help="Port number to bind the proxy to. (default: %(default)s)",
help=f"Port number to bind the proxy to. {help_suffix_template}",
)

if config_str:
Expand Down

0 comments on commit 7187620

Please sign in to comment.