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

Re: 'whence' question

On 11/05/2014 08:43 PM, Bart Schaefer wrote:
The pattern accepted by the -m option is not a glob,

That seems very counterintuitive! I'm taking it as a regular glob just as, I think,
anyone would.
it's a pattern of
the string-matching variety.  If we were to simply glue each of the
arguments onto the end of each $path directory and glob the resulting
cross-product, the wrong results could be returned.  Furthermore, for
e.g. cygwin, the filled hash table has dealt with mapping "foo.exe"
onto "foo" with the suffix case-insensitive, so even a string match
against the file names across $path could be wrong.

Having just written that, it occurs to me that perhaps the "right way"
is the equivalent of this? --

	whence -a ${(k)commands[(I)pattern]}
I couldn't get any love from that.  What I do in my wrapper is this:

    echo -e "\n\e[31;1mACTIVE:\n\e[0m`whence -mv "$1"`"
    echo -e "\n\e[31;1mSHADOWED AND/OR LINKS:\
                  \n\e[0m`whence -sav "${1//'*'/}"`"

$ i zsh* << (i)nformation = mostly from whence.

zsh is /usr/local/bin/zsh
zsh-ok is /usr/local/bin/zsh-ok
zsh-test1 is /usr/local/bin/zsh-test1
zsh-test2-orig-rebuild is /usr/local/bin/zsh-test2-orig-rebuild

zsh is /usr/local/bin/zsh -> /usr/local/bin/zsh-test2-orig-rebuild
zsh is /usr/bin/zsh -> /usr/local/bin/zsh-test2-orig-rebuild
zsh is /bin/zsh -> /usr/local/bin/zsh-test2-orig-rebuild

... which is a bit clumsy, but if I type ' i zsh* ' I want 'whence-ish' information on the intuitive meaning of 'zsh*' and I want to see links, and 'shadowed' files because they may very well be part of a chain of links, as is true above. But '-m'
won't permit '-s', and '-a' won't permit glob.  I hope that something more
friendly can be come up with. I hope it's " whence -as "zsh*" "

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