introduce custom object for cmdline arguments

Allows to define special functions over the arguments.

Also splits CLI tests in two files as they have become too many.
This commit is contained in:
Sarah Hoffmann
2021-02-24 10:38:19 +01:00
parent f6e894a53a
commit 7222235579
6 changed files with 173 additions and 105 deletions

View File

@@ -12,6 +12,7 @@ from .config import Configuration
from .tools.exec_utils import run_legacy_script, run_php_server
from .errors import UsageError
from . import clicmd
from .clicmd.args import NominatimArgs
LOG = logging.getLogger()
@@ -62,7 +63,8 @@ class CommandlineParser:
""" Parse the command line arguments of the program and execute the
appropriate subcommand.
"""
args = self.parser.parse_args(args=kwargs.get('cli_args'))
args = NominatimArgs()
self.parser.parse_args(args=kwargs.get('cli_args'), namespace=args)
if args.subcommand is None:
self.parser.print_help()