Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

_man completion update for Solaris



After finally looking at Daniel's _man changes, I saw that there were a
couple of small (pre-existing) issues on Solaris.  Namely: the -s option
can take a comma-separated list of sections; and the man-index directory
gets thrown into the mix when it shouldn't.  This patch takes care of those
two things.

I don't know if the comma/colon section separation should just be generic
-- it's safe to do on Solaris, since although we don't recognize the
separator, we don't have any sections that have colons in them -- but I
don't know if it's compatible with the third if clause there.

I also didn't protect the /man-index/ removal with an OSTYPE check because
that seems safe enough on any OS, but there may be no reason not to do
that, either.

Thanks,
Danek

diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index ae6ac38..b2aaeaf 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -46,6 +46,7 @@ _man() {
   local sect sect_dirname
   if [[ $OSTYPE = solaris* ]]; then
     sect=${${words[(R)-s*]#-s}:-$words[$words[(i)-s]+1]}
+    sect="${sect//,/|}"
   elif [[ -n ${sect:=$words[$words[(i)-S]+1]} || -n ${sect:=$MANSECT} ]]; then
     sect="${sect//:/|}"
     sect="${sect//,/|}"
@@ -67,6 +68,8 @@ _man() {
     dirs=( $^_manpath/(sman|man|cat)*/ )
     awk='{print $1}'
   fi
+  # Solaris 11 and on have a man-index directory that doesn't contain manpages
+  dirs=( ${dirs:#*/man-index/} )
   if [[ $OSTYPE = solaris* && ( $words[CURRENT] = -s* || $words[CURRENT-1] == -s ) ]]; then
     [[ $words[CURRENT] = -s* ]] && compset -P '-s'
     sects=( ${(o)${dirs##*(man|cat)}%/} )



Messages sorted by: Reverse Date, Date, Thread, Author