From 68ea6600ae48810d956b81f6b6c85dc1325378bb Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Fri, 2 Feb 2024 14:52:58 +0100 Subject: [PATCH] Warnings for command line options only allowed in slim mode --- src/command-line-parser.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/command-line-parser.cpp b/src/command-line-parser.cpp index 0a92f190e..a02dc6961 100644 --- a/src/command-line-parser.cpp +++ b/src/command-line-parser.cpp @@ -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) { @@ -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) { @@ -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);