Skip to content

Commit

Permalink
Remove "create" bool from options
Browse files Browse the repository at this point in the history
It is just the inverse of "append" and never used except to check that
--append and --create are not used together.
  • Loading branch information
joto committed Mar 27, 2024
1 parent 13af586 commit 32be519
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/command-line-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,6 @@ static void check_options_output_pgsql(CLI::App const &app, options_t *options)

static void check_options(options_t *options)
{
if (options->append && options->create) {
throw std::runtime_error{"--append and --create options can not be "
"used at the same time!"};
}

if (options->append && !options->slim) {
throw std::runtime_error{"--append can only be used with slim mode!"};
}
Expand Down Expand Up @@ -291,7 +286,7 @@ options_t parse_command_line(int argc, char *argv[])
->description("Update existing osm2pgsql database (needs --slim).");

// --create
app.add_flag("-c,--create", options.create)
app.add_flag("-c,--create")
->description("Import OSM data from file into database. This is the "
"default if --append is not used.");

Expand Down Expand Up @@ -687,6 +682,11 @@ options_t parse_command_line(int argc, char *argv[])
return options;
}

if (options.append && app.count("--create")) {
throw std::runtime_error{"--append and --create options can not be "
"used at the same time!"};
}

check_options(&options);

if (options.slim) { // slim mode, use database middle
Expand Down
1 change: 0 additions & 1 deletion src/options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ struct options_t
bool reproject_area = false;

bool parallel_indexing = true;
bool create = false;
bool pass_prompt = false;
}; // struct options_t

Expand Down

0 comments on commit 32be519

Please sign in to comment.