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

Method _process_config_file

simcore/framework/src/cli/cli.hpp:6426–6453  ·  view source on GitHub ↗

Read and process a configuration file (main app only)

Source from the content-addressed store, hash-verified

6424
6425 /// Read and process a configuration file (main app only)
6426 void _process_config_file() {
6427 if (config_ptr_ != nullptr) {
6428 bool config_required = config_ptr_->get_required();
6429 bool file_given = config_ptr_->count() > 0;
6430 auto config_file = config_ptr_->as<std::string>();
6431 if (config_file.empty()) {
6432 if (config_required) {
6433 throw FileError::Missing("no specified config file");
6434 }
6435 return;
6436 }
6437
6438 auto path_result = detail::check_path(config_file.c_str());
6439 if (path_result == detail::path_type::file) {
6440 try {
6441 std::vector<ConfigItem> values = config_formatter_->from_file(config_file);
6442 _parse_config(values);
6443 if (!file_given) {
6444 config_ptr_->add_result(config_file);
6445 }
6446 } catch (const FileError &) {
6447 if (config_required || file_given) throw;
6448 }
6449 } else if (config_required || file_given) {
6450 throw FileError::Missing(config_file);
6451 }
6452 }
6453 }
6454
6455 /// Get envname options if not yet passed. Runs on *all* subcommands.
6456 void _process_env() {

Callers

nothing calls this directly

Calls 6

check_pathFunction · 0.85
from_fileMethod · 0.80
add_resultMethod · 0.80
get_requiredMethod · 0.45
countMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected