Skip to content

Commit d463a63

Browse files
committed
Warnings for command line options only allowed in slim mode
1 parent 0ea9a42 commit d463a63

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

src/command-line-parser.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#endif
2828

2929
#include <algorithm>
30+
#include <array>
3031
#include <cstdio>
3132
#include <cstring>
3233
#include <stdexcept>
@@ -128,6 +129,25 @@ void print_version()
128129
#endif
129130
}
130131

132+
static void check_options_non_slim(CLI::App const &app)
133+
{
134+
std::array<std::string, 7> const slim_options = {
135+
"--flat-nodes",
136+
"--middle-database-format",
137+
"--middle-schema",
138+
"--middle-with-nodes",
139+
"--middle-way-node-index-id-shift",
140+
"--tablespace-slim-data",
141+
"--tablespace-slim-index"};
142+
143+
for (auto const &opt : slim_options) {
144+
if (app.count(opt) > 0) {
145+
log_warn("Ignoring option {}. Can only be used in --slim mode.",
146+
app.get_option(opt)->get_name(false, true));
147+
}
148+
}
149+
}
150+
131151
static void check_options_output_flex(CLI::App const &app)
132152
{
133153
auto const ignored_options = app.get_options([](CLI::Option const *option) {
@@ -221,10 +241,6 @@ static void check_options(options_t *options)
221241
"processing a lot.");
222242
}
223243
}
224-
225-
if (!options->slim && !options->flat_node_file.empty()) {
226-
log_warn("Ignoring --flat-nodes/-F setting in non-slim mode");
227-
}
228244
}
229245

230246
static void check_options_expire(options_t *options) {
@@ -687,6 +703,10 @@ options_t parse_command_line(int argc, char *argv[])
687703
return options;
688704
}
689705

706+
if (!options.slim) {
707+
check_options_non_slim(app);
708+
}
709+
690710
if (options.output_backend == "flex") {
691711
check_options_output_flex(app);
692712
} else if (options.output_backend == "gazetteer") {

0 commit comments

Comments
 (0)