mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 13:24:07 +00:00
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:
22
nominatim/clicmd/args.py
Normal file
22
nominatim/clicmd/args.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
Provides custom functions over command-line arguments.
|
||||
"""
|
||||
|
||||
|
||||
class NominatimArgs:
|
||||
""" Customized namespace class for the nominatim command line tool
|
||||
to receive the command-line arguments.
|
||||
"""
|
||||
|
||||
def osm2pgsql_options(self, default_cache, default_threads):
|
||||
""" Return the standard osm2pgsql options that can be derived
|
||||
from the command line arguments. The resulting dict can be
|
||||
further customized and then used in `run_osm2pgsql()`.
|
||||
"""
|
||||
return dict(osm2pgsql=self.config.OSM2PGSQL_BINARY or self.osm2pgsql_path,
|
||||
osm2pgsql_cache=self.osm2pgsql_cache or default_cache,
|
||||
osm2pgsql_style=self.config.get_import_style_file(),
|
||||
threads=self.threads or default_threads,
|
||||
dsn=self.config.get_libpq_dsn(),
|
||||
flatnode_file=self.config.FLATNODE_FILE)
|
||||
|
||||
Reference in New Issue
Block a user