zsh-workers
 help / color / mirror / code / Atom feed
* _man completion update for Solaris
@ 2016-09-06 18:06 Danek Duvall
  2016-09-06 22:45 ` Daniel Shahaf
  0 siblings, 1 reply; 3+ messages in thread
From: Danek Duvall @ 2016-09-06 18:06 UTC (permalink / raw)
  To: zsh-workers

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)}%/} )


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-07  1:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-06 18:06 _man completion update for Solaris Danek Duvall
2016-09-06 22:45 ` Daniel Shahaf
2016-09-07  1:11   ` Danek Duvall

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).