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

Re: [PATCH 1/4] run-help: Support variables in aliases



Bart Schaefer schrieb am Wed 17. May, 15:45 (-0700):
> On Wed, May 17, 2023 at 3:13 PM Jörg Sommer <joerg@xxxxxxxx> wrote:
> >
> > If the alias definition starts with a variable assignment, run-help fails,
> > because it sees the variable assignment as command. Hence, skip all
> > variable assignments and noglob|nocorrect thereafter.
> 
> This may not be the right way to handle this.  The same thing is
> already being attempted in the block at
> 
>     (*)
>         if ((! didman++))
>         then
> 
> where you'll see
> 
>                 # Discard the command itself & everything before it.
> 
> so I would have expected the existing recursive call to cover it.  If
> recursion is NOT handling it, then maybe we need to pull that whole
> thing up to before the original "whence" command?

At least for me, the current code doesn't work:

```
% zsh -f
zenbook% lsb_release -d
Description:    Debian GNU/Linux 12 (bookworm)
zenbook% echo $ZSH_VERSION
5.9

zenbook% alias LCC='LC_ALL=C'; alias T='LCC true'
zenbook% run-help T
No manual entry for T
```

> Either way, we already have
> 
>     (*( is an alias for (noglob|nocorrect))*)

The patch eliminates this case, since the code to remove the variables also
belongs there.

> I repeat my earlier remarks about "reaching the point of diminishing
> returns" with our attempts to turn run-help into a full command-line
> parser.

I see. That's a fair point. What would be a better attempt to support
variables in aliases?

-- 
Dein Gesicht wird dir geschenkt. Lächeln musst du selbst! (Inga Hermann)

Attachment: signature.asc
Description: PGP signature



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