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

Re: Default true boolean zstyle



Bart Schaefer wrote on Fri, Oct 14, 2016 at 10:53:01 -0700:
> On Thu, Oct 13, 2016 at 11:27 PM, Sebastian Gniazdowski
> <sgniazdowski@xxxxxxxxx> wrote:
> >
> > Apparently, zstyle -b returns false when the boolean being read is
> > false.
> >
> > Is there a way to have default-true boolean with zstyle?
> 
> You have to use
>     zstyle -T :test-context test-style && test_var=yes || zstyle -b
> :test-context test-style test_var

It's still surprising (and undocumented) that -b returns false when the
value of the style is false.  I expected it to return 0 for the same
reason that _call_function returns 0 when the called function returns
non-zero: $? == 0 means retrieving the value succeeded; check $test_var
to see what the value is.

But it's been this way for 15+ years...



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