|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <filesystem> |
|
|
#include <filesystem> |
|
|
#include <iostream> |
|
|
#include <iostream> |
|
|
|
|
|
#include <sstream> |
|
|
|
|
|
|
|
|
namespace { |
|
|
namespace { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
common_flags _common{cmd}; |
|
|
common_flags _common{cmd}; |
|
|
|
|
|
|
|
|
catalog_path_flag cat_path{cmd}; |
|
|
catalog_path_flag cat_path{cmd}; |
|
|
|
|
|
|
|
|
|
|
|
args::Flag import_stdin{cmd, "stdin", "Import JSON from stdin", {"stdin"}}; |
|
|
args::ValueFlagList<std::string> |
|
|
args::ValueFlagList<std::string> |
|
|
json_paths{cmd, |
|
|
json_paths{cmd, |
|
|
"json", |
|
|
"json", |
|
|
|
|
|
|
|
|
for (const auto& json_fpath : json_paths.Get()) { |
|
|
for (const auto& json_fpath : json_paths.Get()) { |
|
|
cat.import_json_file(json_fpath); |
|
|
cat.import_json_file(json_fpath); |
|
|
} |
|
|
} |
|
|
|
|
|
if (import_stdin.Get()) { |
|
|
|
|
|
std::ostringstream strm; |
|
|
|
|
|
strm << std::cin.rdbuf(); |
|
|
|
|
|
cat.import_json_str(strm.str()); |
|
|
|
|
|
} |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
} import{*this}; |
|
|
} import{*this}; |