fish-shell/doc_src/cmds
Fabian Homborg 64b34c8cda Allow complete to have multiple conditions
This makes it so `complete -c foo -n test1 -n test2` registers *both*
conditions, and when it comes time to check the candidate, tries both,
in that order. If any fails it stops, if all succeed the completion is offered.

The reason for this is that it helps with caching - we have a
condition cache, but conditions like

```fish
test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] length

test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub
```

defeats it pretty easily, because the cache only looks at the entire
script as a string - it can't tell that the first `test` is the same
in both.

So this means we separate it into

```fish
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] length" -s V -l visible -d "Use the visible width, excluding escape sequences"
+complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] length" -s V -l visible -d "Use the visible width, excluding escape sequences"
```

which allows the `test` to be cached.

In tests, this improves performance for the string completions by 30%
by reducing all the redundant `test` calls.

The `git` completions can also greatly benefit from this.
2022-05-30 20:47:14 +02:00
..
_.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
abbr.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
alias.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
and.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
argparse.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
begin.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
bg.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
bind.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
block.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
break.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
breakpoint.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
builtin.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
case.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
cd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
cdh.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
command.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
commandline.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
complete.rst Allow complete to have multiple conditions 2022-05-30 20:47:14 +02:00
contains.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
continue.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
count.rst docs synopsis: make all placeholder arguments uppercase 2022-01-19 22:56:41 +08:00
dirh.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
dirs.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
disown.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
echo.rst docs: removed enumeration item from echo docs 2022-04-22 20:16:14 +02:00
else.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
emit.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
end.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
eval.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
exec.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
exit.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
false.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fg.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
fish.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_add_path.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
fish_breakpoint_prompt.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_command_not_found.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_config.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
fish_git_prompt.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_greeting.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_hg_prompt.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_indent.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
fish_is_root_user.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_key_reader.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
fish_mode_prompt.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_opt.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
fish_prompt.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_right_prompt.rst We no longer have two doc systems, move sphinx_doc_src back to doc_src 2020-02-19 17:00:35 -08:00
fish_status_to_signal.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_svn_prompt.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
fish_title.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_update_completions.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_vcs_prompt.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
for.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
funced.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
funcsave.rst Put funcsave long option back 2022-03-24 20:11:39 +01:00
function.rst Allow trapping SIGINT and SIGTERM in scripts 2022-05-28 17:44:13 -07:00
functions.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
help.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
history.rst docs: standardise on definition lists for options 2022-03-12 00:21:12 +08:00
if.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
isatty.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
jobs.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
math.rst docs/math: Some simple changes 2022-05-14 10:59:41 +02:00
nextd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
not.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
open.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
or.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
path.rst Rename sort --invert to sort --reverse/-r 2022-05-29 17:53:03 +02:00
popd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
prevd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
printf.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
prompt_hostname.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
prompt_login.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
prompt_pwd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
psub.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
pushd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
pwd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
random.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
read.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
realpath.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
return.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
set.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
set_color.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
source.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
status.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
string-collect.rst Fix more lost string documentation 2022-05-14 10:05:02 +02:00
string-escape.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-join.rst New -n flag for string join. (#8774) 2022-03-13 11:47:33 +01:00
string-join0.rst We no longer have two doc systems, move sphinx_doc_src back to doc_src 2020-02-19 17:00:35 -08:00
string-length.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-lower.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-match.rst Fix more lost string documentation 2022-05-14 10:05:02 +02:00
string-pad.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-repeat.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-replace.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-split.rst Docs: be more consistent about argument formatting 2022-05-14 10:05:02 +02:00
string-split0.rst We no longer have two doc systems, move sphinx_doc_src back to doc_src 2020-02-19 17:00:35 -08:00
string-sub.rst Fix more lost string documentation 2022-05-14 10:05:02 +02:00
string-trim.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-unescape.rst We no longer have two doc systems, move sphinx_doc_src back to doc_src 2020-02-19 17:00:35 -08:00
string-upper.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string.rst Docs: be more consistent about argument formatting 2022-05-14 10:05:02 +02:00
suspend.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
switch.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
test.rst Is this a typo? 2022-03-23 15:04:25 +01:00
time.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
trap.rst Allow trapping SIGINT and SIGTERM in scripts 2022-05-28 17:44:13 -07:00
true.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
type.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
ulimit.rst ulimit: add new limits from FreeBSD/NetBSD 2022-03-24 10:23:04 +08:00
umask.rst docs: standardise on definition lists for options 2022-03-12 00:21:12 +08:00
vared.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
wait.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
while.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00