zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: whence (was Re: local unfunction)
Date: Sat, 31 Mar 2018 10:21:01 -0700	[thread overview]
Message-ID: <6935145d-785f-f2dd-d4f2-e7ea627e2bc3@eastlink.ca> (raw)
In-Reply-To: <CAH+w=7Zz4HMfB_RA5nHr_i_iwKvD=S0QOjcogc0Y0OYSXv0JXw@mail.gmail.com>

On 31/03/18 08:25 AM, Bart Schaefer wrote:
> % whence -wm "zsh*"

$ whence -wm "zsh*"
zsh: command
zsh5.3: command        # binary
zsh5.3:: command        # text file

... I've yet to understand what the point of the '-w' switch is. I dunno 
Bart, it seems I'm the only guy who has issues with whence so perhaps I 
shouldn't belabour all this but it seems riddled with bugs to me. '-m' 
and '-a' seem to fight each other and the results are inconclusive.  
whence is important, one needs to know what is going to be executed when 
one types a command, these ifs and buts are frustrating.  My wrapper 
around whence is approaching 300 lines, and it's only purpose is to give 
one-stop shopping for what, it seems to me, whence should do anyway:

-a # keep looking after the first match (the one to be executed) is found

-m # find all matches of a pattern, subsumes '-a'  (executable ONLY 
unless ... )

-t # Show non executable (text?) files as well, obviates -a, subsumes 'm'.

-s, -S  # Expand links, even if found on 'dot' on the path.

So: 'whence -mts "zsh*" ' ... would give me one stop shopping for 
anything that is either directly executable or sourcable via path search 
(which zsh does anyway).  '-a' is actually redundant:

$ whenz zsh # Command that will be executed.

$ whenz -m zsh # Keep searching. (no pattern but so what, keep searching 
anyway.)

$ whenz -m "zsh*" # Keep searching and match the pattern too (because 
one is given).

$ whenz -mt "zsh*" # As above, but match non executables on the path as 
well.

$ whenz -mtS "zsh*" As above but show link chains, even on the 'dot', 
even on Tuesdays.

Logical?


  reply	other threads:[~2018-03-31 17:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-31 15:25 Bart Schaefer
2018-03-31 17:21 ` Ray Andrews [this message]
2018-04-01  1:18   ` Bart Schaefer
2018-04-01  4:29     ` Ray Andrews
2018-04-01 17:33     ` Daniel Shahaf
2018-04-01 18:17       ` Bart Schaefer
2018-04-04 18:10         ` Daniel Shahaf
2018-04-05  0:20           ` Bart Schaefer
2018-04-05  1:41             ` Ray Andrews
2018-04-05  5:08               ` Bart Schaefer
2018-04-05 14:28                 ` Ray Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6935145d-785f-f2dd-d4f2-e7ea627e2bc3@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).