30 if (cli_options_as_json.
contains(
"min")) {
31 json_combined[
"supercells"][
"min"] = cli_options_as_json[
"min"];
33 if (cli_options_as_json.
contains(
"max")) {
34 json_combined[
"supercells"][
"max"] = cli_options_as_json[
"max"];
36 if (cli_options_as_json.
contains(
"scelnames")) {
37 json_combined[
"scelnames"] = cli_options_as_json[
"scelnames"];
39 if (cli_options_as_json.
contains(
"confignames")) {
40 json_combined[
"confignames"] = cli_options_as_json[
"scelnames"];
42 if (cli_options_as_json.
contains(
"all") &&
43 cli_options_as_json[
"all"] ==
true) {
44 if (json_combined.contains(
"supercells")) {
45 json_combined.
erase(
"supercells");
47 if (json_combined.contains(
"scelnames")) {
48 json_combined.erase(
"scelnames");
50 if (json_combined.contains(
"confignames")) {
51 json_combined.erase(
"confignames");
53 if (json_combined.contains(
"config_selection")) {
54 json_combined.erase(
"config_selection");
56 json_combined[
"supercell_selection"] =
"ALL";
58 if (cli_options_as_json.
contains(
"filter")) {
59 json_combined[
"filter"] = cli_options_as_json[
"filter"];
61 if (cli_options_as_json.
contains(
"verbosity")) {
62 json_combined[
"verbosity"] = cli_options_as_json[
"verbosity"];
64 if (cli_options_as_json.
contains(
"dry_run")) {
65 json_combined[
"dry_run"] = cli_options_as_json[
"dry_run"];
75 parser.
value = notstd::make_unique<ConfigEnumOptions>(
primclex);
76 auto &options = *parser.
value;
78 options.method_name = method_name;
80 parser.
optional_else(options.primitive_only,
"primitive_only",
true);
86 parser.
optional(options.filter_expression,
"filter");
87 if (!options.filter_expression.empty()) {
92 parser.
optional_else(options.output_configurations,
"output_configurations",
95 if (options.output_configurations) {
98 fs::path base{
"output_configurations_options"};
100 std::string file_path_str;
101 parser.
optional_else<std::string>(file_path_str, base /
"path",
"enum.out");
102 fs::path file_path{file_path_str};
107 bool json_arrays_output;
108 parser.
optional_else(json_arrays_output, base /
"json_arrays",
false);
114 if (file_path.extension() !=
".gz" && file_path.extension() !=
".GZ") {
119 bool output_filtered_configurations;
121 base /
"output_filtered_configurations",
false);
124 file_path, json_output, json_arrays_output, compress};
125 options.output_filtered_configurations = output_filtered_configurations;
PrimClex is the top-level data structure for a CASM project.
bool contains(const std::string &name) const
Return true if JSON object contains 'name'.
size_type erase(const std::string &name)
Erase key:value pair from an object.
DataFormatterFilter< DataObject > make_data_formatter_filter(std::string const &filter_expr, DataFormatterDictionary< DataObject > const &_dict)
int parse_verbosity(KwargsParser &parser, int default_verbosity=10)
jsonParser combine_configuration_enum_json_options(jsonParser const &json_options, jsonParser const &cli_options_as_json)
void parse(InputParser< ConfigEnumOptions > &parser, std::string method_name, PrimClex const &primclex, DataFormatterDictionary< Configuration > const &dict)