|
10 | 10 | #include "config.h" |
11 | 11 | #include "format.hpp" |
12 | 12 | #include "logging.hpp" |
| 13 | +#include "node-ram-cache.hpp" |
13 | 14 | #include "options.hpp" |
| 15 | +#include "reprojection.hpp" |
14 | 16 | #include "sprompt.hpp" |
15 | 17 |
|
16 | 18 | #include <algorithm> |
@@ -97,13 +99,7 @@ const struct option long_options[] = { |
97 | 99 | {"with-forward-dependencies", required_argument, nullptr, 217}, |
98 | 100 | {nullptr, 0, nullptr, 0}}; |
99 | 101 |
|
100 | | -void short_usage(char *arg0) |
101 | | -{ |
102 | | - throw std::runtime_error{"Usage error. For further information call:" |
103 | | - " {} --help"_format(program_name(arg0))}; |
104 | | -} |
105 | | - |
106 | | -void long_usage(char const *arg0, bool verbose) |
| 102 | +static void long_usage(char const *arg0, bool verbose) |
107 | 103 | { |
108 | 104 | char const *const name = program_name(arg0); |
109 | 105 |
|
@@ -347,7 +343,7 @@ options_t::options_t(int argc, char *argv[]) : options_t() |
347 | 343 | { |
348 | 344 | // If there are no command line arguments at all, show help. |
349 | 345 | if (argc == 1) { |
350 | | - long_usage_bool = true; |
| 346 | + m_print_help = true; |
351 | 347 | long_usage(argv[0], false); |
352 | 348 | return; |
353 | 349 | } |
@@ -523,7 +519,7 @@ options_t::options_t(int argc, char *argv[]) : options_t() |
523 | 519 | } |
524 | 520 | break; |
525 | 521 | case 'h': |
526 | | - long_usage_bool = true; |
| 522 | + m_print_help = true; |
527 | 523 | break; |
528 | 524 | case 'I': |
529 | 525 | parallel_indexing = false; |
@@ -642,20 +638,20 @@ options_t::options_t(int argc, char *argv[]) : options_t() |
642 | 638 | break; |
643 | 639 | case '?': |
644 | 640 | default: |
645 | | - short_usage(argv[0]); |
646 | | - break; |
| 641 | + throw std::runtime_error{"Usage error. Try 'osm2pgsql --help'."}; |
647 | 642 | } |
648 | 643 | } //end while |
649 | 644 |
|
650 | 645 | //they were looking for usage info |
651 | | - if (long_usage_bool) { |
| 646 | + if (m_print_help) { |
652 | 647 | long_usage(argv[0], help_verbose); |
653 | 648 | return; |
654 | 649 | } |
655 | 650 |
|
656 | 651 | //we require some input files! |
657 | | - if (argc == optind) { |
658 | | - short_usage(argv[0]); |
| 652 | + if (optind >= argc) { |
| 653 | + throw std::runtime_error{ |
| 654 | + "Missing input file(s). Try 'osm2pgsql --help'."}; |
659 | 655 | } |
660 | 656 |
|
661 | 657 | //get the input files |
|
0 commit comments