zsh-users
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Default true boolean zstyle
Date: Fri, 14 Oct 2016 08:27:40 +0200	[thread overview]
Message-ID: <CAKc7PVDZJH28+x-FPNB3tKxP7z1yY73KJAqjnX1tTQjgegdH4Q@mail.gmail.com> (raw)

Hello,
following code explains:

% zstyle -b ":test-context" test_var test_var || test_var="yes"
% echo $test_var
yes
% zstyle ":test-context" test_var 0
% zstyle -b ":test-context" test_var test_var || test_var="yes"
% echo $test_var
yes

Apparently, zstyle -b returns false when the boolean being read is
false. So "|| test_var=yes" is triggered, and the value is
overwritten. Following way also doesn't do what's expected:

% test_var="yes"
% zstyle -b ":test-context" test_var test_var
% echo $test_var
no

Is there a way to have default-true boolean with zstyle?

Best regards,
Sebastian Gniazdowski


             reply	other threads:[~2016-10-14  6:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-14  6:27 Sebastian Gniazdowski [this message]
2016-10-14 17:53 ` Bart Schaefer
     [not found] ` <CAH+w=7Za9OrnssbzWN88F2RHoFdVhNKy0_k93P=ZQXQcjY2RZg__38913.3170749576$1476473552$gmane$org@mail.gmail.com>
2016-10-14 20:12   ` Daniel Shahaf

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=CAKc7PVDZJH28+x-FPNB3tKxP7z1yY73KJAqjnX1tTQjgegdH4Q@mail.gmail.com \
    --to=sgniazdowski@gmail.com \
    --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).