void leaf_action(init_config, Val* pval, conf_expr_base const& conf) const {
   this->check_leaf_impl(pval, conf);
   conf_opt const& opt = *conf.opt;
   std::string const& pathname = conf.path_name();
   using graehl::add;
   if (opt.is_required_warn()) add(popt->warn_missing, pathname);
   if (opt.is_required_err()) add(popt->error_missing, pathname);
   popt->opt_desc.option(poname(conf), pval, opt.get_usage() + opt.get_init_or_eg_suffix_quote(*this),
                         po(pathname, opt, pval));
   SHOWIF3(CONFEXPR, 1, "declare: option added: ", pval, pathname, conf);
   if (opt.is_positional()) {
     SHOWIF2(CONFEXPR, 1, "positional ", pathname, conf);
     popt->positional.add(
         conf.path_name().c_str(),  // ok to pass c_str() since it's stored in a string immediately
         opt.positional->max <= 0 ? -1 : opt.positional->max);
   }
 }
Example #2
0
 static inline std::string poname(conf_expr_base const& conf) {
   conf_opt const& opt = *conf.opt;
   std::string name = conf.path_name();
   if (opt.charname) {
     name.append(",");
     name.append(1, *opt.charname);
   }
   return name;
 }
Example #3
0
 void leaf_action(store_config, Val* pval, conf_expr_base const& conf) const {
   std::string const& pathname = conf.path_name();
   auto& opt = *conf.opt;
   if (std::string const* v = get(pathname))
     opt.apply_string_value(*v, pval, pathname, warn);
   else if (opt.is_required_err())
     missing(pathname, false);
   else if (opt.is_required_warn())
     missing(pathname, true);
 }
Example #4
0
 void tree_action(init_config, Val* pval, conf_expr_base const& conf) const {
   conf_opt const& opt = *conf.opt;
   if (opt.allows_unrecognized()) popt->allow_unrecognized(conf.path_name(), *opt.allow_unrecognized);
 }