mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-24 19:51:14 -03:00
Rebase documentation changes
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
\section complete complete - edit command specific tab-completions
|
||||
|
||||
\subsection complete-synopsis Synopsis
|
||||
<tt>complete (-c|--command|-p|--path) COMMAND [(-s|--short-option) SHORT_OPTION] [(-l|--long-option|-o|--old-option) LONG_OPTION [(-a||--arguments) OPTION_ARGUMENTS] [(-w|--wraps) WRAPPED_COMMAND] [(-d|--description) DESCRIPTION] </tt>
|
||||
\fish{synopsis}
|
||||
complete ( -c | --command | -p | --path ) COMMAND
|
||||
[( -s | --short-option ) SHORT_OPTION]
|
||||
[( -l | --long-option | -o | --old-option ) LONG_OPTION]
|
||||
[( -a | --arguments ) OPTION_ARGUMENTS]
|
||||
[( -w | --wraps ) WRAPPED_COMMAND]
|
||||
[( -d | --description ) DESCRIPTION]
|
||||
\endfish
|
||||
|
||||
\subsection complete-description Description
|
||||
|
||||
@@ -9,29 +16,39 @@ For an introduction to specifying completions, see <a
|
||||
href='index.html#completion-own'>Writing your own completions</a> in
|
||||
the fish manual.
|
||||
|
||||
- <tt>COMMAND</tt> is the name of the command for which to add a completion
|
||||
- <tt>SHORT_OPTION</tt> is a one character option for the command
|
||||
- <tt>LONG_OPTION</tt> is a multi character option for the command
|
||||
- <tt>OPTION_ARGUMENTS</tt> is parameter containing a space-separated list of possible option-arguments, which may contain subshells
|
||||
- <tt>DESCRIPTION</tt> is a description of what the option and/or option arguments do
|
||||
- <tt>-C STRING</tt> or <tt>--do-complete=STRING</tt> makes complete try to find all possible completions for the specified string
|
||||
- <tt>-e</tt> or <tt>--erase</tt> implies that the specified completion should be deleted
|
||||
- <tt>-f</tt> or <tt>--no-files</tt> specifies that the option specified by this completion may not be followed by a filename
|
||||
- <tt>-n</tt> or <tt>--condition</tt> specifies a shell command that must return 0 if the completion is to be used. This makes it possible to specify completions that should only be used in some cases.
|
||||
- <tt>-o</tt> or <tt>--old-option</tt> implies that the command uses old long style options with only one dash
|
||||
- <tt>-p</tt> or <tt>--path</tt> implies that the string COMMAND is the full path of the command
|
||||
- <tt>-r</tt> or <tt>--require-parameter</tt> specifies that the option specified by this completion always must have an option argument, i.e. may not be followed by another option
|
||||
- <tt>-u</tt> or <tt>--unauthoritative</tt> implies that there may be more options than the ones specified, and that fish should not assume that options not listed are spelling errors
|
||||
- <tt>-A</tt> or <tt>--authoritative</tt> implies that there may be no more options than the ones specified, and that fish should assume that options not listed are spelling errors
|
||||
- <tt>-x</tt> or <tt>--exclusive</tt> implies both <tt>-r</tt> and <tt>-f</tt>
|
||||
- <tt>-w WRAPPED_COMMAND</tt> or <tt>--wraps=WRAPPED_COMMAND</tt> causes the specified command to inherit completions from the wrapped comamnd.
|
||||
- `COMMAND` is the name of the command for which to add a completion.
|
||||
|
||||
Command specific tab-completions in \c 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_OPTION` is a one character option for the command.
|
||||
|
||||
- `LONG_OPTION` is a multi character option for the command.
|
||||
|
||||
- `OPTION_ARGUMENTS` is parameter containing a space-separated list of possible option-arguments, which may contain subshells.
|
||||
|
||||
- `DESCRIPTION` is a description of what the option and/or option arguments do.
|
||||
|
||||
- `-C STRING` or `--do-complete=STRING` makes complete try to find all possible completions for the specified string.
|
||||
|
||||
- `-w WRAPPED_COMMAND` or `--wraps=WRAPPED_COMMAND` causes the specified command to inherit completions from the wrapped command.
|
||||
|
||||
- `-e` or `--erase` implies that the specified completion should be deleted.
|
||||
|
||||
- `-f` or `--no-files` specifies that the option specified by this completion may not be followed by a filename.
|
||||
|
||||
- `-n` or `--condition` specifies a shell command that must return 0 if the completion is to be used. This makes it possible to specify completions that should only be used in some cases.
|
||||
|
||||
- `-o` or `--old-option` implies that the command uses old long style options with only one dash.
|
||||
|
||||
- `-p` or `--path` implies that the string `COMMAND` is the full path of the command.
|
||||
|
||||
- `-r` or `--require-parameter` specifies that the option specified by this completion always must have an option argument, i.e. may not be followed by another option.
|
||||
|
||||
- `-u` or `--unauthoritative` implies that there may be more options than the ones specified, and that fish should not assume that options not listed are spelling errors.
|
||||
|
||||
- `-A` or `--authoritative` implies that there may be no more options than the ones specified, and that fish should assume that options not listed are spelling errors.
|
||||
|
||||
- `-x` or `--exclusive` implies both `-r` and `-f`.
|
||||
|
||||
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`').
|
||||
|
||||
@@ -76,9 +93,11 @@ complete -c rpm -n "__fish_contains_opt -s e erase" -l nodeps -d "Don't check de
|
||||
|
||||
where `__fish_contains_opt` is a function that checks the commandline buffer for the presence of a specified set of options.
|
||||
|
||||
To implement an alias, use the \c -w or \c --wraps option:
|
||||
To implement an alias, use the `-w` or `--wraps` option:
|
||||
|
||||
<tt>complete -c hub -w git</tt>
|
||||
\fish
|
||||
complete -c hub -w git
|
||||
\endfish
|
||||
|
||||
Now hub inherits all of the completions from git. Note this can also be specified in a function declaration.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user