diff --git a/src/builtin_complete.cpp b/src/builtin_complete.cpp index bca0d85d9..286c09aa9 100644 --- a/src/builtin_complete.cpp +++ b/src/builtin_complete.cpp @@ -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': {