Propagate ShellContext custom env-vars through custom commands
Fixes #1131
This commit is contained in:
parent
4916ea1766
commit
ffc362cf9e
|
@ -882,15 +882,16 @@ void define_command(const ParametersParser& parser, Context& context, const Shel
|
|||
min = max = (size_t)str_to_int(counts);
|
||||
|
||||
desc = ParameterDesc{ {}, ParameterDesc::Flags::SwitchesAsPositional, min, max };
|
||||
cmd = [=](const ParametersParser& parser, Context& context, const ShellContext&) {
|
||||
CommandManager::instance().execute(commands, context, { params_to_shell(parser) });
|
||||
cmd = [=](const ParametersParser& parser, Context& context, const ShellContext& sc) {
|
||||
CommandManager::instance().execute(commands, context,
|
||||
{ params_to_shell(parser), sc.env_vars });
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
desc = ParameterDesc{ {}, ParameterDesc::Flags::SwitchesAsPositional, 0, 0 };
|
||||
cmd = [=](const ParametersParser& parser, Context& context, const ShellContext&) {
|
||||
CommandManager::instance().execute(commands, context);
|
||||
cmd = [=](const ParametersParser& parser, Context& context, const ShellContext& sc) {
|
||||
CommandManager::instance().execute(commands, context, { {}, sc.env_vars });
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user