Skip to content

Commit

Permalink
Warnings for command line options only allowed in slim mode
Browse files Browse the repository at this point in the history
  • Loading branch information
joto committed Feb 2, 2024
1 parent e251bc2 commit 68ea660
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/command-line-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,24 @@ void print_version()
#endif
}

static void check_options_non_slim(CLI::App const &app)
{
auto const slim_options = {"--flat-nodes",
"--middle-database-format",
"--middle-schema",
"--middle-with-nodes",
"--middle-way-node-index-id-shift",
"--tablespace-slim-data",
"--tablespace-slim-index"};

for (auto const *opt : slim_options) {
if (app.count(opt) > 0) {
log_warn("Ignoring option {}. Can only be used in --slim mode.",
app.get_option(opt)->get_name(false, true));
}
}
}

static void check_options_output_flex(CLI::App const &app)
{
auto const ignored_options = app.get_options([](CLI::Option const *option) {
Expand Down Expand Up @@ -221,10 +239,6 @@ static void check_options(options_t *options)
"processing a lot.");
}
}

if (!options->slim && !options->flat_node_file.empty()) {
log_warn("Ignoring --flat-nodes/-F setting in non-slim mode");
}
}

static void check_options_expire(options_t *options) {
Expand Down Expand Up @@ -687,6 +701,10 @@ options_t parse_command_line(int argc, char *argv[])
return options;
}

if (!options.slim) {
check_options_non_slim(app);
}

if (options.output_backend == "flex") {
check_options_output_flex(app);
check_options_expire(&options);
Expand Down

0 comments on commit 68ea660

Please sign in to comment.