-
Notifications
You must be signed in to change notification settings - Fork 455
RFC: cli --config
global option: allow spaces around =
#6169
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
base: main
Are you sure you want to change the base?
Conversation
Maybe you know, but the reason why whitespace is not stripped is that we allow bare strings. In POSIX shell, |
I think it's OK to require quotes, as in |
I was originally going to say:
Upon experimenting,
fails but
works. To me, this means that stripping the space before the
I added a test for this, seems to work. |
This is especially useful for complicated options like ``` --config 'revsets."immutable_heads()" = "none()"' ```
Another confusing thing is that, before this PR, we have: $ jj --config "ui . color =never" status # Works fine
The working copy has no changes.
Working copy : olqzpw d8e5196 (empty) (no description set)
Parent commit: qqruox 386bb6d parse_bookmark_name plain
[22:14] macaw ~/dev/jj <qqru>→<olqz|∅>
$ jj --config "ui . color = never" status # Boom!
Config error: Invalid type or value for ui.color
Caused by: unknown variant ` never`, expected one of `always`, `never`, `debug`, `auto`
For help, see https://jj-vcs.github.io/jj/latest/config/ or use `jj help -k config`. After this PR, both would work. |
Correct. The key part is parsed strictly, whereas the value parsing is lax. For consistency reason, I wouldn't want to add extra whitespace handling to key parsing, though. |
I think you're referring to the example in #6169 (comment) right before the sentence you quoted. IIUC, you're implying that example is a victim of issues like #5748, which makes perfect sense then. It's a small price to pay.
The key already seems agnostic to whitespace, I guess you're referring to value parsing? The inconsistency with keys vs values still bothers me, as well as the inconsistency with TOML syntax (which allows spaces around Update: OTOH, it's possible that you or your unconscious mind is worried about some consequence of allowing spaces before values that I'm missing, so if it feels really uncomfortable, I don't want to force the issue. |
Yeah, it would be nice if the key parser were strict about whitespace (for consistency with the unquoted value handling), but I don't think it would worth the effort to roll our own key parsing function. |
I know @yuja originally forbid this intentionally, but I find it confusing that something like
was forbidden Update: while
--config 'ui . color =always'
works.Checklist
If applicable:
CHANGELOG.md
[ ] I have updated the config schema (cli/src/config-schema.json)