mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
optionally hand in command line arguments to CLI functions
Allows easier testing.
This commit is contained in:
@@ -68,10 +68,11 @@ class CommandlineParser:
|
|||||||
""" Parse the command line arguments of the program and execute the
|
""" Parse the command line arguments of the program and execute the
|
||||||
appropriate subcommand.
|
appropriate subcommand.
|
||||||
"""
|
"""
|
||||||
args = self.parser.parse_args()
|
args = self.parser.parse_args(args=kwargs.get('cli_args'))
|
||||||
|
|
||||||
if args.subcommand is None:
|
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'):
|
for arg in ('module_dir', 'osm2pgsql_path', 'phplib_dir', 'data_dir', 'phpcgi_path'):
|
||||||
setattr(args, arg, Path(kwargs[arg]))
|
setattr(args, arg, Path(kwargs[arg]))
|
||||||
|
|||||||
Reference in New Issue
Block a user