From: Sarah Hoffmann Date: Wed, 20 Jan 2021 08:04:04 +0000 (+0100) Subject: optionally hand in command line arguments to CLI functions X-Git-Tag: v3.7.0~49^2~4 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/041ae67fd9dcf685dc2057210fa88fb2026f0336 optionally hand in command line arguments to CLI functions Allows easier testing. --- diff --git a/nominatim/cli.py b/nominatim/cli.py index 70481b4a..02b30f19 100644 --- a/nominatim/cli.py +++ b/nominatim/cli.py @@ -68,10 +68,11 @@ class CommandlineParser: """ Parse the command line arguments of the program and execute the appropriate subcommand. """ - args = self.parser.parse_args() + args = self.parser.parse_args(args=kwargs.get('cli_args')) if args.subcommand is None: - return self.parser.print_help() + self.parser.print_help() + return 1 for arg in ('module_dir', 'osm2pgsql_path', 'phplib_dir', 'data_dir', 'phpcgi_path'): setattr(args, arg, Path(kwargs[arg]))