summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_man
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2022-04-11 00:17:48 +0200
committerAxel Beckert <abe@deuxchevaux.org>2022-04-11 00:17:48 +0200
commitb09f4483416c54c1782824633dfabaf2ec0265b6 (patch)
tree304bc82642862525ae680c7fbaa249663b10ad57 /Completion/Unix/Command/_man
parent12eb3e5356f2fc3351eed58ef1cef1b8fb83b504 (diff)
parent6e55c920503071e917619b8cb1a188cd35d772db (diff)
downloadzsh-b09f4483416c54c1782824633dfabaf2ec0265b6.tar.gz
zsh-b09f4483416c54c1782824633dfabaf2ec0265b6.zip
New upstream version 5.8.1.2-test
Diffstat (limited to 'Completion/Unix/Command/_man')
-rw-r--r--Completion/Unix/Command/_man22
1 files changed, 14 insertions, 8 deletions
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 7d55201e3..dba1d13dc 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -6,7 +6,6 @@
# - We assume that Linux distributions are using either man-db or mandoc
# - @todo Would be nice to support completing the initial operand as a section
# name (on non-Solaris systems)
-# - @todo We don't support the man-db syntax <name>.<section> (e.g., `ls.1`)
# - @todo We don't support the man-db feature of 'sub-pages' — that is, treating
# pairs of operands like `git diff` as `git-diff`
# - @todo Option exclusivity isn't super accurate
@@ -415,7 +414,7 @@ _man() {
}
_man_pages() {
- local pages sopt
+ local pages sopt tmp
# What files corresponding to manual pages can end in.
local suf='.((?|<->*|ntcl)(|.gz|.bz2|.z|.Z|.lzma))'
@@ -444,13 +443,20 @@ _man_pages() {
# `POSIX.1.5'.
[[ $variant = solaris* ]] && sopt='-s '
- if ((CURRENT > 1 || noinsert)) ||
- ! zstyle -t ":completion:${curcontext}:manuals.$sect_dirname" insert-sections
- then
- compadd "$@" - ${pages%$~suf}
- else
- compadd "$@" -P "$sopt$sect_dirname " - ${pages%$~suf}
+ if ! ((CURRENT > 1 || noinsert)); then
+ zstyle -s ":completion:${curcontext}:manuals.$sect_dirname" insert-sections tmp
fi
+ case "$tmp" in
+ prepend|true|on|yes|1)
+ compadd "$@" -P "$sopt$sect_dirname " - ${pages%$~suf}
+ ;;
+ suffix)
+ compadd "$@" -s ".$sect_dirname" - ${pages%$~suf}
+ ;;
+ *)
+ compadd "$@" - ${pages%$~suf}
+ ;;
+ esac
}
_man "$@"