From: marc tobias Date: Mon, 8 Apr 2024 16:07:49 +0000 (+0200) Subject: CLI: get valid --format values via autodiscover X-Git-Tag: deploy~9^2~1^2 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/28444d94350287d6c27675e740ec8fa64a5403ae CLI: get valid --format values via autodiscover --- diff --git a/nominatim/clicmd/api.py b/nominatim/clicmd/api.py index e8450e6b..3c5416fe 100644 --- a/nominatim/clicmd/api.py +++ b/nominatim/clicmd/api.py @@ -17,6 +17,7 @@ from nominatim.clicmd.args import NominatimArgs import nominatim.api as napi import nominatim.api.v1 as api_output from nominatim.api.v1.helpers import zoom_to_rank, deduplicate_results +from nominatim.api.v1.format import dispatch as formatting import nominatim.api.logging as loglib # Do not repeat documentation of subcommand classes. @@ -44,7 +45,7 @@ EXTRADATA_PARAMS = ( def _add_api_output_arguments(parser: argparse.ArgumentParser) -> None: group = parser.add_argument_group('Output arguments') group.add_argument('--format', default='jsonv2', - choices=['xml', 'json', 'jsonv2', 'geojson', 'geocodejson', 'debug'], + choices=formatting.list_formats(napi.SearchResults) + ['debug'], help='Format of result') for name, desc in EXTRADATA_PARAMS: group.add_argument('--' + name, action='store_true', help=desc)