From 57ce75eb67e292b2ddb7036619646ab73690ecfd Mon Sep 17 00:00:00 2001 From: AntoJvlt Date: Fri, 26 Mar 2021 01:57:51 +0100 Subject: [PATCH] Change command 'import-special-phrases --from-wiki' to 'special-phrases --import-from-wiki'. --- .github/workflows/ci-tests.yml | 2 +- docs/admin/Import.md | 2 +- lib-php/admin/specialphrases.php | 2 +- nominatim/cli.py | 2 +- nominatim/clicmd/special_phrases.py | 6 +++--- test/python/test_cli.py | 2 +- test/testfiles/phrase_settings.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index e0e68a9c..2f920a66 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -120,7 +120,7 @@ jobs: working-directory: data-env - name: Import special phrases - run: nominatim special-phrases --from-wiki | psql -d nominatim + run: nominatim special-phrases --import-from-wiki working-directory: data-env - name: Check import diff --git a/docs/admin/Import.md b/docs/admin/Import.md index 43b11e91..e3a32481 100644 --- a/docs/admin/Import.md +++ b/docs/admin/Import.md @@ -270,7 +270,7 @@ If you want to be able to search for places by their type through [special key phrases](https://wiki.openstreetmap.org/wiki/Nominatim/Special_Phrases) you also need to import these key phrases like this: - nominatim import-special-phrases --from-wiki + nominatim special-phrases --import-from-wiki Note that this command downloads the phrases from the wiki link above. You need internet access for the step. diff --git a/lib-php/admin/specialphrases.php b/lib-php/admin/specialphrases.php index 92e655d0..84bcfb5c 100644 --- a/lib-php/admin/specialphrases.php +++ b/lib-php/admin/specialphrases.php @@ -7,5 +7,5 @@ require_once(CONST_LibDir.'/init-cmd.php'); loadSettings(getcwd()); (new \Nominatim\Shell(getSetting('NOMINATIM_TOOL'))) - ->addParams('import-special-phrases', '--from-wiki') + ->addParams('special-phrases', '--import-from-wiki') ->run(); diff --git a/nominatim/cli.py b/nominatim/cli.py index d6d8e388..0876d9a4 100644 --- a/nominatim/cli.py +++ b/nominatim/cli.py @@ -254,7 +254,7 @@ def nominatim(**kwargs): parser.add_subcommand('freeze', clicmd.SetupFreeze) parser.add_subcommand('replication', clicmd.UpdateReplication) - parser.add_subcommand('import-special-phrases', clicmd.ImportSpecialPhrases) + parser.add_subcommand('special-phrases', clicmd.ImportSpecialPhrases) parser.add_subcommand('add-data', UpdateAddData) parser.add_subcommand('index', clicmd.UpdateIndex) diff --git a/nominatim/clicmd/special_phrases.py b/nominatim/clicmd/special_phrases.py index a35a9742..99e82592 100644 --- a/nominatim/clicmd/special_phrases.py +++ b/nominatim/clicmd/special_phrases.py @@ -1,5 +1,5 @@ """ - Implementation of the 'import-special-phrases' command. + Implementation of the 'special-phrases' command. """ import logging from nominatim.tools.special_phrases import SpecialPhrasesImporter @@ -17,12 +17,12 @@ class ImportSpecialPhrases: @staticmethod def add_args(parser): group = parser.add_argument_group('Input arguments') - group.add_argument('--from-wiki', action='store_true', + group.add_argument('--import-from-wiki', action='store_true', help='Import special phrases from the OSM wiki to the database.') @staticmethod def run(args): - if args.from_wiki: + if args.import_from_wiki: LOG.warning('Special phrases importation starting') with connect(args.config.get_libpq_dsn()) as db_connection: SpecialPhrasesImporter( diff --git a/test/python/test_cli.py b/test/python/test_cli.py index 9aeca3de..eb0ee584 100644 --- a/test/python/test_cli.py +++ b/test/python/test_cli.py @@ -174,7 +174,7 @@ def test_index_command(mock_func_factory, temp_db_cursor, params, do_bnds, do_ra def test_special_phrases_command(temp_db, mock_func_factory): func = mock_func_factory(nominatim.clicmd.special_phrases.SpecialPhrasesImporter, 'import_from_wiki') - call_nominatim('import-special-phrases', '--from-wiki') + call_nominatim('special-phrases', '--import-from-wiki') assert func.called == 1 diff --git a/test/testfiles/phrase_settings.php b/test/testfiles/phrase_settings.php index f64b8d3b..945235bd 100644 --- a/test/testfiles/phrase_settings.php +++ b/test/testfiles/phrase_settings.php @@ -17,4 +17,4 @@ $aTagsWhitelist = array( 'highway' => array('bus_stop', 'rest_area', 'raceway'), 'building' => array(), - ); \ No newline at end of file + ); -- 2.45.1