Fix unset option when using the current scope and it points to global
This commit is contained in:
parent
2a6f36732d
commit
c4a9f059dc
|
@ -1085,10 +1085,10 @@ const CommandDesc unset_option_cmd = {
|
||||||
},
|
},
|
||||||
[](const ParametersParser& parser, Context& context, const ShellContext&)
|
[](const ParametersParser& parser, Context& context, const ShellContext&)
|
||||||
{
|
{
|
||||||
if (parser[0] == "global")
|
auto& options = get_options(parser[0], context, parser[1]);
|
||||||
|
if (&options == &GlobalScope::instance().options())
|
||||||
throw runtime_error("Cannot unset options in global scope");
|
throw runtime_error("Cannot unset options in global scope");
|
||||||
|
options.unset_option(parser[1]);
|
||||||
get_options(parser[0], context, parser[1]).unset_option(parser[1]);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user