mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00: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:
parent
f2724da45c
commit
17cf255bf7
1 changed files with 7 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue