37 std::ostream& output = std::cout;
38 std::string delimiter =
",";
41 bool distinct =
false;
42 bool summarize =
false;
43 bool output_json =
false;
73 stack_opt.error = boost::none;
79 return "INCOMPLETE (" + std::string(e.what()) +
")";
81 return "INVALID (" + std::string(e.what()) +
")";
82 }
catch (std::exception& e) {
83 return "ERROR (" + std::string(e.what()) +
")";
94 stack_opt.error = boost::none;
106 }
catch (std::exception& e) {
114 inline int check_merged(
const CheckOptions& opt,
const std::vector<std::string>& filepaths) {
116 if (opt.output_json) {
117 opt.output << check_json(opt, filepaths, &ok).dump(opt.json_indent) << std::endl;
118 }
else if (opt.summarize) {
119 opt.output <<
check_summary(opt, filepaths, &ok) << std::endl;
124 }
catch (std::exception& e) {
125 opt.output << e.what() << std::endl;
129 return ok ? EXIT_SUCCESS : EXIT_FAILURE;
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) {
139 exit_code = EXIT_FAILURE;
144 if (opt.output_json) {
147 check_each([&](
const auto& f,
bool* ok) {
148 output[f] =
check_json(opt, std::vector<std::string>{f}, ok);
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;
156 check_each([&](
const auto& f,
bool* ok) {
158 check_stack(opt.stack_options, std::vector<std::string>{f}, ok);
160 }
catch (std::exception& e) {
161 opt.output << f <<
": " << e.what() << std::endl;
169 inline int check(
const CheckOptions& opt,
const std::vector<std::string>& filepaths) {
171 return check_distinct(opt, filepaths);
173 return check_merged(opt, filepaths);
Definition: stack.hpp:888
Definition: stack.hpp:901
void check_completeness() const
Definition: stack.cpp:729
Definition: error.hpp:149
void check_stack(const cloe::StackOptions &opt, const std::vector< std::string > &files, bool *ok=nullptr)
Definition: main_check.hpp:53
cloe::Json check_json(const CheckOptions &opt, const std::vector< std::string > &files, bool *ok=nullptr)
Definition: main_check.hpp:91
std::string check_summary(const CheckOptions &opt, const std::vector< std::string > &files, bool *ok=nullptr)
Definition: main_check.hpp:70
Definition: main_stack.hpp:38
Definition: main_check.hpp:35