Skip to content

Commit

Permalink
don't warn about using obsolete complete options
Browse files Browse the repository at this point in the history
Fixes #3640
  • Loading branch information
Kurtis Rader committed Jan 9, 2017
1 parent 4223b3d commit f365f72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
4 changes: 4 additions & 0 deletions doc_src/complete.txt
Expand Up @@ -61,6 +61,10 @@ the fish manual.


- `-C` or `--do-complete` with no argument makes complete try to find all possible completions for the current command line buffer. If the shell is not in interactive mode, an error is returned. - `-C` or `--do-complete` with no argument makes complete try to find all possible completions for the current command line buffer. If the shell is not in interactive mode, an error is returned.


- `-A` and `--authoritative` no longer do anything and are silently ignored.

- `-u` and `--unauthoritative` no longer do anything and are silently ignored.

Command specific tab-completions in `fish` are based on the notion of options and arguments. An option is a parameter which begins with a hyphen, such as '`-h`', '`-help`' or '`--help`'. Arguments are parameters that do not begin with a hyphen. Fish recognizes three styles of options, the same styles as the GNU version of the getopt library. These styles are: Command specific tab-completions in `fish` are based on the notion of options and arguments. An option is a parameter which begins with a hyphen, such as '`-h`', '`-help`' or '`--help`'. Arguments are parameters that do not begin with a hyphen. Fish recognizes three styles of options, the same styles as the GNU version of the getopt library. These styles are:


- Short options, like '`-a`'. Short options are a single character long, are preceded by a single hyphen and may be grouped together (like '`-la`', which is equivalent to '`-l -a`'). Option arguments may be specified in the following parameter ('`-w 32`') or by appending the option with the value ('`-w32`'). - Short options, like '`-a`'. Short options are a single character long, are preceded by a single hyphen and may be grouped together (like '`-la`', which is equivalent to '`-l -a`'). Option arguments may be specified in the following parameter ('`-w 32`') or by appending the option with the value ('`-w32`').
Expand Down
19 changes: 2 additions & 17 deletions src/builtin_complete.cpp
Expand Up @@ -21,9 +21,6 @@
#include "wgetopt.h" #include "wgetopt.h"
#include "wutil.h" // IWYU pragma: keep #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 // 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 // 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 // you to specify multiple switches on a single commandline, like 'complete -s a -s b -s c', but the
Expand Down Expand Up @@ -187,23 +184,11 @@ int builtin_complete(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
break; break;
} }
case 'u': { case 'u': {
if (!authoritative_flag_warning) { // This option was removed in commit 1911298 and is now a no-op.
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; break;
} }
case 'A': { case 'A': {
if (!authoritative_flag_warning) { // This option was removed in commit 1911298 and is now a no-op.
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; break;
} }
case 's': { case 's': {
Expand Down

0 comments on commit f365f72

Please sign in to comment.