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

Re: Bug in zparseopts -G?



On Thu 4 Sep 2025, at 10:19, Clinton Bunch wrote:
> I get it's how tilde expansion works, once I saw it I knew what was 
> happening, but it remains (at least IMHO) unexpected behavior when -G is 
> supposed to make command line parsing  behave like other programs with 
> long options.

it does. the behaviour is exactly the same as with any other tool that
takes options using that syntax

  % getopt -V
  getopt from util-linux 2.40.2
  % getopt -l option: '' -- --option=~/path
   -- '--option=~/path'

On Thu 4 Sep 2025, at 10:19, Clinton Bunch wrote:
> How many script users are going to expect that, though?  And know that 
> what they need is magic_equal_subst?

it doesn't matter whether it's a script, it's just how the shell parses
and expands the command line. it's the same in bash, dash, ksh, etc --
and those don't even have a magic_equal_subst equivalent to change it
afaik

On Thu 4 Sep 2025, at 10:19, Clinton Bunch wrote:
> Would setting the option just 
> before zparseopts in the script fix it?

it won't, because the expansion happens (or doesn't) when the user
enters the command

On Thu 4 Sep 2025, at 10:19, Clinton Bunch wrote:
> I contend end users are going to expect any script using --option=~/path 
> to expand the tilde regardless if they have magic_equal_subst set in 
> their shell or not.

why would they expect that of a script when it doesn't work that way for
anything else?

if you mean users might like magic_equal_subst enabled by default
generally, idk. maybe. i like it personally. but i think there's pretty
much zero chance that it will be changed in the shell itself at this
point. and our previous attempt at creating a user-friendly default
profile failed

dana




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