@@ -139,66 +139,70 @@ struct Streamer {
139139
140140// ---------------------------------------------------------------------------
141141
142- static int usage (Streamer &strm) {
143- strm.cerr
144- << " usage: projinfo [-o formats] "
145- " [-k crs|operation|datum|ensemble|ellipsoid] "
146- " [--summary] [-q]"
147- << std::endl
148- << " ([--area name_or_code] | "
149- " [--bbox west_long,south_lat,east_long,north_lat]) "
150- << std::endl
151- << " [--spatial-test contains|intersects]" << std::endl
152- << " [--crs-extent-use none|both|intersection|smallest]"
153- << std::endl
154- << " [--grid-check "
155- " none|discard_missing|sort|known_available] "
156- << std::endl
157- << " [--pivot-crs always|if_no_direct_transformation|"
158- << " never|{auth:code[,auth:code]*}]" << std::endl
159- << " [--show-superseded] [--hide-ballpark] "
160- " [--accuracy {accuracy}]"
161- << std::endl
162- << " [--allow-ellipsoidal-height-as-vertical-crs]"
163- << std::endl
164- << " [--boundcrs-to-wgs84]" << std::endl
165- << " [--authority name]" << std::endl
166- << " [--main-db-path path] [--aux-db-path path]*"
167- << std::endl
168- << " [--identify] [--3d]" << std::endl
169- << " [--output-id AUTH:CODE]" << std::endl
170- << " [--c-ify] [--single-line]" << std::endl
171- << " --searchpaths | --remote-data |" << std::endl
172- << " --list-crs [list-crs-filter] |" << std::endl
173- << " --dump-db-structure [{object_definition} | "
174- " {object_reference}] |"
175- << std::endl
176- << " {object_definition} | {object_reference} |"
177- << std::endl
178- << " (-s {srs_def} [--s_epoch {epoch}] "
179- " -t {srs_def} [--t_epoch {epoch}]) |"
180- << std::endl
181- << " ({srs_def} {srs_def})" << std::endl;
182- strm.cerr << std::endl;
183- strm.cerr << " -o: formats is a comma separated combination of: "
184- " all,default,PROJ,WKT_ALL,WKT2:2015,WKT2:2019,WKT1:GDAL,"
185- " WKT1:ESRI,PROJJSON,SQL"
186- << std::endl;
187- strm.cerr << " Except 'all' and 'default', other format can be preceded "
188- " by '-' to disable them"
189- << std::endl;
190- strm.cerr << std::endl;
191- strm.cerr << " list-crs-filter is a comma separated combination of: "
192- " allow_deprecated,geodetic,geocentric,"
193- << std::endl;
194- strm.cerr
195- << " geographic,geographic_2d,geographic_3d,vertical,projected,compound"
196- << std::endl;
197- strm.cerr << std::endl;
198- strm.cerr << " {object_definition} might be a PROJ string, a WKT string, "
199- " a AUTHORITY:CODE, or urn:ogc:def:OBJECT_TYPE:AUTHORITY::CODE"
200- << std::endl;
201- return 1 ;
142+ static int usage (Streamer &strm, bool is_error = true ) {
143+ std::stringstream s;
144+ s << " usage: projinfo [-o formats] "
145+ " [-k crs|operation|datum|ensemble|ellipsoid] "
146+ " [--summary] [-q]"
147+ << std::endl
148+ << " ([--area name_or_code] | "
149+ " [--bbox west_long,south_lat,east_long,north_lat]) "
150+ << std::endl
151+ << " [--spatial-test contains|intersects]" << std::endl
152+ << " [--crs-extent-use none|both|intersection|smallest]"
153+ << std::endl
154+ << " [--grid-check "
155+ " none|discard_missing|sort|known_available] "
156+ << std::endl
157+ << " [--pivot-crs always|if_no_direct_transformation|"
158+ << " never|{auth:code[,auth:code]*}]" << std::endl
159+ << " [--show-superseded] [--hide-ballpark] "
160+ " [--accuracy {accuracy}]"
161+ << std::endl
162+ << " [--allow-ellipsoidal-height-as-vertical-crs]"
163+ << std::endl
164+ << " [--boundcrs-to-wgs84]" << std::endl
165+ << " [--authority name]" << std::endl
166+ << " [--main-db-path path] [--aux-db-path path]*"
167+ << std::endl
168+ << " [--identify] [--3d]" << std::endl
169+ << " [--output-id AUTH:CODE]" << std::endl
170+ << " [--c-ify] [--single-line]" << std::endl
171+ << " --searchpaths | --remote-data |" << std::endl
172+ << " --list-crs [list-crs-filter] |" << std::endl
173+ << " --dump-db-structure [{object_definition} | "
174+ " {object_reference}] |"
175+ << std::endl
176+ << " {object_definition} | {object_reference} |"
177+ << std::endl
178+ << " (-s {srs_def} [--s_epoch {epoch}] "
179+ " -t {srs_def} [--t_epoch {epoch}]) |"
180+ << std::endl
181+ << " ({srs_def} {srs_def})" << std::endl;
182+ s << std::endl;
183+ s << " -o: formats is a comma separated combination of: "
184+ " all,default,PROJ,WKT_ALL,WKT2:2015,WKT2:2019,WKT1:GDAL,"
185+ " WKT1:ESRI,PROJJSON,SQL"
186+ << std::endl;
187+ s << " Except 'all' and 'default', other format can be preceded "
188+ " by '-' to disable them"
189+ << std::endl;
190+ s << std::endl;
191+ s << " list-crs-filter is a comma separated combination of: "
192+ " allow_deprecated,geodetic,geocentric,"
193+ << std::endl;
194+ s << " geographic,geographic_2d,geographic_3d,vertical,projected,compound"
195+ << std::endl;
196+ s << std::endl;
197+ s << " {object_definition} might be a PROJ string, a WKT string, "
198+ " a AUTHORITY:CODE, or urn:ogc:def:OBJECT_TYPE:AUTHORITY::CODE"
199+ << std::endl;
200+ if (is_error) {
201+ strm.cerr << s.str ();
202+ } else {
203+ strm.cout << s.str ();
204+ }
205+ return is_error ? 1 : 0 ;
202206}
203207
204208// ---------------------------------------------------------------------------
@@ -1883,7 +1887,7 @@ static int main_projinfo(PJ_CONTEXT *ctx, int argc, char **argv,
18831887#endif
18841888 return 0 ;
18851889 } else if (arg == " -?" || arg == " --help" ) {
1886- return usage (strm);
1890+ return usage (strm, false );
18871891 } else if (arg[0 ] == ' -' ) {
18881892 strm.cerr << " Unrecognized option: " << arg << std::endl;
18891893 return usage (strm);
0 commit comments