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

need for a fancier _pick_variant?



I was debugging why

    % diff -u foo ba<TAB>

failed to complete "bar" on Solaris.  The reason, of course is that
_diff_options calls

    _pick_variant -c diff 'gnu=GNU' unix -v

which doesn't match anything for Solaris diff, so the generic unix diff
options are chosen, and the result is thrown by the -u.

Unfortunately, I don't know of any way of distinguishing Solaris diff by
its output, short of a brittle check of its usage statement.  I can,
however, reliably check what options are available for it by running
"what /usr/bin/diff", noting SunOS, and the OS version.

I tried a very naive

   _pick_variant -c what -r diff solaris=SunOS unix '$(whence diff)'

as the test for an elif clause in _diff_options, but it didn't work.  On
re-reading the man page, I misunderstood what -r did, but that's only
the tip of the iceberg here.

I next tried

  elif [[ $(what $(whence $cmd)) == *SunOS\ 5.<9->* ]]; then

which seems to work pretty nicely.  Would you suggest that as a
solution, or to try to beef up _pick_variant to support running
auxiliary programs as tests?

Hm.  In investigating all this, I noticed that all the completion
directories end up duplicated in $fpath, which seems to be done in
compaudit.  This seems to happen on 4.0.5 on Solaris, 4.1.1 on Solaris,
and 4.1.1 on Linux, FWIW.

Thanks,
Danek



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