Add access to specific env vars in %val{...} evaluation

This commit is contained in:
Maxime Coste 2014-07-30 19:17:04 +01:00
parent 31f9d87798
commit 4c31449a65

View File

@ -323,7 +323,12 @@ String eval_token(const Token& token, Context& context,
case Token::Type::OptionExpand: case Token::Type::OptionExpand:
return context.options()[content].get_as_string(); return context.options()[content].get_as_string();
case Token::Type::ValExpand: case Token::Type::ValExpand:
{
auto it = env_vars.find(content);
if (it != env_vars.end())
return it->second;
return ShellManager::instance().get_val(content, context); return ShellManager::instance().get_val(content, context);
}
case Token::Type::RawEval: case Token::Type::RawEval:
return eval(content, context, shell_params, env_vars); return eval(content, context, shell_params, env_vars);
case Token::Type::Raw: case Token::Type::Raw: