Feature flag support for ? wildcard

This partially reverts 6e56637cf0 and #4520
by bringing back the ? wildcard, guarded by the qmark-noglob feature flag.
This commit is contained in:
ridiculousfish
2018-05-05 19:11:57 -07:00
parent dc8d603f98
commit 762c31be87
13 changed files with 117 additions and 41 deletions

View File

@@ -92,6 +92,7 @@ Some characters can not be written directly on the command line. For these chara
- '<code>\\$</code>' escapes the dollar character
- '<code>\\\\</code>' escapes the backslash character
- '<code>\\*</code>' escapes the star character
- '<code>\\?</code>' escapes the question mark character
- '<code>\\~</code>' escapes the tilde character
- '<code>\\#</code>' escapes the hash character
- '<code>\\(</code>' escapes the left parenthesis character
@@ -329,7 +330,7 @@ These are the general purpose tab completions that `fish` provides:
- Completion of usernames for tilde expansion.
- Completion of filenames, even on strings with wildcards such as '`*`' and '`**`'.
- Completion of filenames, even on strings with wildcards such as '`*`', '`**`' and '`?`'.
`fish` provides a large number of program specific completions. Most of these completions are simple options like the `-l` option for `ls`, but some are more advanced. The latter include:
@@ -417,7 +418,9 @@ When an argument for a program is given on the commandline, it undergoes the pro
\subsection expand-wildcard Wildcards
If a star (`*`) is present in the parameter, `fish` attempts to match the given parameter to any files in such a way that:
If a star (`*`) or a question mark (`?`) is present in the parameter, `fish` attempts to match the given parameter to any files in such a way that:
- `?` can match any single character except '/'.
- `*` can match any string of characters not containing '/'. This includes matching an empty string.
@@ -443,6 +446,8 @@ Examples:
- `a*` matches any files beginning with an 'a' in the current directory.
- `???` matches any file in the current directory whose name is exactly three characters long.
- `**` matches any files and directories in the current directory and all of its subdirectories.
Note that for most commands, if any wildcard fails to expand, the command is not executed, <a href='#variables-status'>`$status`</a> is set to nonzero, and a warning is printed. This behavior is consistent with setting `shopt -s failglob` in bash. There are exactly 3 exceptions, namely <a href="commands.html#set">`set`</a>, <a href="commands.html#count">`count`</a> and <a href="commands.html#for">`for`</a>. Their globs are permitted to expand to zero arguments, as with `shopt -s nullglob` in bash.