Skip to content

Commit fa7d258

Browse files
committed
engine: Remove --distinct option from check command
1 parent d5f3314 commit fa7d258

File tree

2 files changed

+1
-44
lines changed

2 files changed

+1
-44
lines changed

engine/src/main.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ int main(int argc, char** argv) {
6969
engine::CheckOptions check_options;
7070
std::vector<std::string> check_files;
7171
auto check = app.add_subcommand("check", "Validate stack file configurations.");
72-
check->add_flag("-d,--distinct", check_options.distinct, "Validate each file distinctly");
7372
check->add_flag("-s,--summarize", check_options.summarize, "Summarize results");
7473
check->add_flag("-j,--json", check_options.output_json, "Output results as JSON data");
7574
check->add_option("-J,--json-indent", check_options.json_indent, "JSON indentation level");

engine/src/main_check.hpp

+1-43
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ struct CheckOptions {
3838
std::string delimiter = ",";
3939

4040
// Flags:
41-
bool distinct = false;
4241
bool summarize = false;
4342
bool output_json = false;
4443
int json_indent = 2;
@@ -129,49 +128,8 @@ inline int check_merged(const CheckOptions& opt, const std::vector<std::string>&
129128
return ok ? EXIT_SUCCESS : EXIT_FAILURE;
130129
}
131130

132-
inline int check_distinct(const CheckOptions& opt, const std::vector<std::string>& filepaths) {
133-
int exit_code = EXIT_SUCCESS;
134-
auto check_each = [&](std::function<void(const std::string&, bool*)> func) {
135-
for (const auto& x : filepaths) {
136-
bool ok = true;
137-
func(x, &ok);
138-
if (!ok) {
139-
exit_code = EXIT_FAILURE;
140-
}
141-
}
142-
};
143-
144-
if (opt.output_json) {
145-
// Output for each file a summary
146-
cloe::Json output;
147-
check_each([&](const auto& f, bool* ok) {
148-
output[f] = check_json(opt, std::vector<std::string>{f}, ok);
149-
});
150-
opt.output << output.dump(opt.json_indent) << std::endl;
151-
} else if (opt.summarize) {
152-
check_each([&](const auto& f, bool* ok) {
153-
opt.output << f << ": " << check_summary(opt, std::vector<std::string>{f}, ok) << std::endl;
154-
});
155-
} else {
156-
check_each([&](const auto& f, bool* ok) {
157-
try {
158-
check_stack(opt.stack_options, std::vector<std::string>{f}, ok);
159-
} catch (cloe::ConcludedError&) {
160-
} catch (std::exception& e) {
161-
opt.output << f << ": " << e.what() << std::endl;
162-
}
163-
});
164-
}
165-
166-
return exit_code;
167-
}
168-
169131
inline int check(const CheckOptions& opt, const std::vector<std::string>& filepaths) {
170-
if (opt.distinct) {
171-
return check_distinct(opt, filepaths);
172-
} else {
173-
return check_merged(opt, filepaths);
174-
}
132+
return check_merged(opt, filepaths);
175133
}
176134

177135
} // namespace engine

0 commit comments

Comments
 (0)