mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 04:41:14 -03:00
warn when people try to do set -ex var
A person asked in issue #4263 why `set -ex fish_greeting` didn't work. So issue an error to let people know that combination doesn't make sense.
This commit is contained in:
@@ -170,6 +170,13 @@ static int validate_cmd_opts(const wchar_t *cmd, set_cmd_opts_t &opts, int argc,
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
// Trying to erase and (un)export at the same time doesn't make sense.
|
||||
if (opts.erase && (opts.exportv || opts.unexport)) {
|
||||
streams.err.append_format(BUILTIN_ERR_COMBO, cmd);
|
||||
builtin_print_help(parser, streams, cmd, streams.err);
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (argc == 0 && opts.erase) {
|
||||
streams.err.append_format(BUILTIN_SET_ERASE_NO_VAR, cmd);
|
||||
builtin_print_help(parser, streams, cmd, streams.err);
|
||||
|
||||
Reference in New Issue
Block a user