mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
only warn about obsolete complete flags once
It was pointed out that the previous change to alert people to the fact their completion scripts were using flags that are no longer valid resulted in way too many warnings. This limits the warning to one per session. Fixes #3640
This commit is contained in:
parent
fc81fa6abf
commit
7a3e0924e0
1 changed files with 17 additions and 4 deletions
|
@ -21,6 +21,9 @@
|
|||
#include "wgetopt.h"
|
||||
#include "wutil.h" // IWYU pragma: keep
|
||||
|
||||
// This boolean ensures we only issue the warning about using the -A/--authoritative flag one time.
|
||||
static bool authoritative_flag_warning = false;
|
||||
|
||||
// builtin_complete_* are a set of rather silly looping functions that make sure that all the proper
|
||||
// combinations of complete_add or complete_remove get called. This is needed since complete allows
|
||||
// you to specify multiple switches on a single commandline, like 'complete -s a -s b -s c', but the
|
||||
|
@ -184,13 +187,23 @@ int builtin_complete(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
|||
break;
|
||||
}
|
||||
case 'u': {
|
||||
streams.err.append_format(
|
||||
_(L"%ls: -u / --unauthoritative flags have been removed\n"), cmd);
|
||||
if (!authoritative_flag_warning) {
|
||||
streams.err.append_format(
|
||||
_(L"%ls: Please update your completion scripts by removing "
|
||||
L"-u / --unauthoritative / -A / --authoritative flags."),
|
||||
cmd);
|
||||
authoritative_flag_warning = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'A': {
|
||||
streams.err.append_format(_(L"%ls: -A / --authoritative flags have been removed\n"),
|
||||
cmd);
|
||||
if (!authoritative_flag_warning) {
|
||||
streams.err.append_format(
|
||||
_(L"%ls: Please update your completion scripts by removing "
|
||||
L"-u / --unauthoritative / -A / --authoritative flags."),
|
||||
cmd);
|
||||
authoritative_flag_warning = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 's': {
|
||||
|
|
Loading…
Reference in a new issue