| 70 | } |
| 71 | |
| 72 | int get_keys(int argc, const char* argv[]) { |
| 73 | TCommonMetaInfoParams params; |
| 74 | NCB::EInfoDumpFormat dumpFormat; |
| 75 | TVector<TString> keys; |
| 76 | auto parser = NLastGetopt::TOpts(); |
| 77 | parser.AddHelpOption(); |
| 78 | params.BindParser(parser); |
| 79 | parser.AddLongOption("key", "keys to dump") |
| 80 | .AppendTo(&keys); |
| 81 | parser.AddLongOption("dump-format", "One of 'Plain', 'JSON'") |
| 82 | .DefaultValue("Plain") |
| 83 | .StoreResult(&dumpFormat); |
| 84 | parser.SetFreeArgDefaultTitle("KEY", "you can use freeargs to select keys"); |
| 85 | NLastGetopt::TOptsParseResult parserResult{&parser, argc, argv}; |
| 86 | for (const auto& key : parserResult.GetFreeArgs()) { |
| 87 | keys.push_back(key); |
| 88 | } |
| 89 | CB_ENSURE(!keys.empty(), "Select at least one property to dump"); |
| 90 | params.LoadModel(); |
| 91 | if (NCB::EInfoDumpFormat::Plain == dumpFormat) { |
| 92 | for (const auto& key : keys) { |
| 93 | Cout << key << "\t" << params.Model.ModelInfo[key] << Endl; |
| 94 | } |
| 95 | } else { |
| 96 | NJson::TJsonValue value; |
| 97 | for (const auto& key : keys) { |
| 98 | value[key] = params.Model.ModelInfo[key]; |
| 99 | } |
| 100 | Cout << value.GetStringRobust() << Endl; |
| 101 | } |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | int dump(int argc, const char* argv[]) { |
| 106 | TCommonMetaInfoParams params; |
nothing calls this directly
no test coverage detected