-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI: treat variables with value true
or false
as boolean
#10342
base: main
Are you sure you want to change the base?
Conversation
Variables with boolean-looking values are now converted to booleans when defined via the command line. This matches the existing behavior for metadata values. Closes: jgm#10340
I'm trying to remember whether there was a reason for not doing this. Here is one possible reason: if a user wants a variable to be the literal string "true", this change would make that impossible. Note that in a defaults file, you already can give variables boolean values (I think). But the YAML format there makes it possible to distinguish between I suppose it's a limitation of the current behavior that one can't give a variable a false value on the command line. But not giving it a value has the same effect in conditionals. |
Being able to give a boolean value of One approach that should prevent rendering changes would be to simply check for the two strings |
I suppose this issue is also related to #10298. One could imagine a special syntax that says: interpret this variable value as JSON. |
In fact this is really really useful IMO. I often have a defaults file or other metadata for general use, but then I want to quickly override the defaults for a one-off document. See for some examples, e.g. I usually set I wonder if we can have some other workaround to set either a string or a boolean, how about @ to identify a string: |
We could allow types to be specified with |
Well, if we had |
An explicit |
I was just thinking that have one "special" marking might allow us to simplify notation, e.g. |
I guess the special marking could go either on in any of three places, so we'd need to think about that:
|
The first of those makes way more sense to me and I dare say would be a lot easier to cope with generating commands programmatically (something I do a lot of): |
Variables with boolean-looking values are now converted to booleans when
defined via the command line. This matches the existing behavior for
metadata values.
Closes: #10340