zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: why is eval needed?
Date: Sun, 20 Nov 2022 05:47:33 -0800	[thread overview]
Message-ID: <b2bb08fe-d184-77ce-b754-7ef77b7ad8ce@eastlink.ca> (raw)
In-Reply-To: <20221120085519.szudhyg5ewrw3b4o@chazelas.org>

On 2022-11-20 00:55, Stephane Chazelas wrote:


It's the caller's role to pass tree, -L and 1 as separate

> arguments.
Yeah I get it.  The first time I 'got it' was when discussing 'aptitude' 
and the various quotings needed.  Again one is creating an invisible 
level of organization imposed on a string of characters.  Where it got 
confusing was when zsh imposed it's own ideas of grouping, making '-L 2' 
into a single entity.  Dunno if it's really a thing to be desired but 
naively one might like some way of assembling a command string as if it 
was at CLI, that is *just* a string of characters -- which is how I was 
looking at it.
> tree parses its options. It looks like it does not use the
> standard getopt() API or the GNU getopt_long() API for that:
>
> $ nm -D =tree | grep -i getopt
> $ ltrace -e '*opt*@*' tree > /dev/null
> +++ exited (status 0) +++
What are you doing there?  I have no 'nm' command here.  No such command 
in Debian repository.
>
> So it must be doing it by hand.
Yeah, so much in the GNU/Linux world is ad hoc.  Everybody did their own 
thing.  No rules.
> In any case zsh (or perl) has no saying on how tree may parse
> its options. You have to invoke it the way its meant to be
> invoked and in the case of tree, the option arguments must be
> passed as separate arguments.
Sure.  The main thing is to just understand that.  Not too difficult 
when you do, something might need splitting or joining but it won't take 
long to figure out.  But why does calling 'eval' fix it?  It seems as if 
eval 'flattens' everything -- one is back to a command line string of 
characters with no imposed grouping.
>
> For most other commands, you would be able to pass them either
> as one -L1 argument or two -L and 1 arguments and also be able
> to combine more than one option in a single argument as in
> -xyL1 (assuming -x and -y are options that don't take
> arguments, are flags/boolean).
>
Yeah, as I was saying, it does seem that 'tree' is very crabby. Why 
don't the GNU people iron these things out?




  reply	other threads:[~2022-11-20 13:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-19 14:34 Ray Andrews
2022-11-19 14:43 ` Roman Perepelitsa
2022-11-19 17:02   ` Ray Andrews
2022-11-19 17:10     ` Roman Perepelitsa
2022-11-19 18:02     ` Clinton Bunch
2022-11-19 18:18       ` Roman Perepelitsa
2022-11-19 16:48 ` Stephane Chazelas
2022-11-19 19:12   ` Ray Andrews
2022-11-19 19:50     ` Lawrence Velázquez
2022-11-19 22:21       ` Ray Andrews
2022-11-20  8:55         ` Stephane Chazelas
2022-11-20 13:47           ` Ray Andrews [this message]
2022-11-20 15:08             ` Stephane Chazelas
2022-11-20 16:27               ` Ray Andrews
2022-11-20 20:16                 ` Stephane Chazelas
2022-11-20 22:31                   ` Bart Schaefer
2022-11-21  2:13                     ` Ray Andrews
2022-11-20 22:47                   ` 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=b2bb08fe-d184-77ce-b754-7ef77b7ad8ce@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).