MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / _parse_single_config

Method _parse_single_config

simcore/framework/src/cli/cli.hpp:6757–6814  ·  view source on GitHub ↗

Fill in a single config option

Source from the content-addressed store, hash-verified

6755
6756 /// Fill in a single config option
6757 bool _parse_single_config(const ConfigItem &item, std::size_t level = 0) {
6758 if (level < item.parents.size()) {
6759 try {
6760 auto subcom = get_subcommand(item.parents.at(level));
6761 auto result = subcom->_parse_single_config(item, level + 1);
6762
6763 return result;
6764 } catch (const OptionNotFound &) {
6765 return false;
6766 }
6767 }
6768 // check for section open
6769 if (item.name == "++") {
6770 if (configurable_) {
6771 increment_parsed();
6772 _trigger_pre_parse(2);
6773 if (parent_ != nullptr) {
6774 parent_->parsed_subcommands_.push_back(this);
6775 }
6776 }
6777 return true;
6778 }
6779 // check for section close
6780 if (item.name == "--") {
6781 if (configurable_) {
6782 _process_callbacks();
6783 _process_requirements();
6784 run_callback();
6785 }
6786 return true;
6787 }
6788 Option *op = get_option_no_throw("--" + item.name);
6789 if (op == nullptr) {
6790 // If the option was not present
6791 if (get_allow_config_extras() == config_extras_mode::capture)
6792 // Should we worry about classifying the extras properly?
6793 missing_.emplace_back(detail::Classifier::NONE, item.fullname());
6794 return false;
6795 }
6796
6797 if (!op->get_configurable()) throw ConfigError::NotConfigurable(item.fullname());
6798
6799 if (op->empty()) {
6800 // Flag parsing
6801 if (op->get_expected_min() == 0) {
6802 auto res = config_formatter_->to_flag(item);
6803 res = op->get_flag_value(item.name, res);
6804
6805 op->add_result(res);
6806
6807 } else {
6808 op->add_result(item.inputs);
6809 op->run_callback();
6810 }
6811 }
6812
6813 return true;
6814 }

Callers

nothing calls this directly

Calls 11

emplace_backMethod · 0.80
fullnameMethod · 0.80
get_expected_minMethod · 0.80
to_flagMethod · 0.80
get_flag_valueMethod · 0.80
add_resultMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45
get_configurableMethod · 0.45
emptyMethod · 0.45
run_callbackMethod · 0.45

Tested by

no test coverage detected