Add --escape option to complete -C

An example use case is an external completion pager:

    bind \cg "commandline -rt (complete -C --escape|fzf|cut -d\t -f1)\ "

Fixes #3469
This commit is contained in:
Nadav Zingerman
2022-01-15 16:57:29 +02:00
committed by Johannes Altmanninger
parent d1d9f147ec
commit 9e0f74eb6c
4 changed files with 22 additions and 5 deletions

View File

@@ -9,7 +9,7 @@ Synopsis
.. synopsis::
complete ((-c | --command) | (-p | --path)) COMMAND [OPTIONS]
complete ((-C | --do-complete)) STRING
complete ((-C | --do-complete)) [STRING] [--escape]
Description
-----------
@@ -49,6 +49,8 @@ the fish manual.
- ``-C STRING`` or ``--do-complete=STRING`` makes complete try to find all possible completions for the specified string. If there is no STRING, the current commandline is used instead.
- When using ``-C``, specify ``--escape`` to escape special characters in completions.
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 getopt library. These styles are:
- Short options, like ``-a``. Short options are a single character long, are preceded by a single hyphen and can be grouped together (like ``-la``, which is equivalent to ``-l -a``). Option arguments may be specified by appending the option with the value (``-w32``), or, if ``--require-parameter`` is given, in the following parameter (``-w 32``).