-
Notifications
You must be signed in to change notification settings - Fork 390
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: ability to disable default configs #5538
base: main
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Thanks, but |
bbdb7f4
to
33c1c16
Compare
@martinvonz The |
Oh, I'm sorry. Interesting. We have a lot of code that depends on the default configs existing, so I think it's going to be more complicated to support than this PR's current state. |
@martinvonz I just noticed. Oops. As a first user who'd want this, I don't mind just adding all the required keys to my config, and thus being sure I am in full control. Also (or/and), I could add Also (or/and) I could add And (or/and), some config toml could be considered "essential", and loaded even with |
f595d73
to
b5a4577
Compare
For the colors issue, I wonder if it'd be better to introduce a notion of themes. So, the colors we have now would become the default theme, and you could reset them all by using another theme. Settings like Recently, scoped config was introduced. I'm not 100% sure about that direction, but perhaps it's sufficient to create a "default theme" scope that contains all the color config and is activated by default. (This would hopefully be relatively easy, but it's not trivial, it still needs some design work on how these theme scopes work) In principle, we could do this to things other than the color config, any kind of thing that people would want to "turn off" en masse, and for which leaving it "undefined" makes sense. Footnotes
|
Instead of having a "theme scope", we could introduce a generic "config scope", that is enabled when a config variable is set to a certain value: [[--scope]]
--when.config = ["ui.enable-colors"] # equivalent to ["ui.enable-colors", "true"]
[--scope.colors]
"error" = { fg = "default", bold = true }
"error_source" = { fg = "default" }
... or [[--scope]]
--when.config = ["ui.theme", ":builtin"]
[--scope.colors]
"error" = { fg = "default", bold = true }
"error_source" = { fg = "default" }
... |
I wouldn't add any "conditional" thingy that also depends on config values (and/or any other dynamic variables.) That would make resolution complicated. For color overrides, it's probably better to add some indirection dedicated for FWIW, the default colors table can be reset by abusing invalid value, but please don't expect this will work forever. [[--scope]]
colors = 0 # reset colors table by assigning non-table value
[[--scope]]
colors.commit_id = "red" |
I agree that this request seems like it would be covered by a "theme"-like config that deals with the "colors" table only. It makes sense to me to consider this a dupe of #3594 . Aside: At the same time, the contrarian in me started wondering about how general such a mechanism could be. I think we could, at an extreme, have a special table In other words, I'm guessing Yuya's main concern was that it would be confusing if scopes would depend on parameters that they could also modify, and I'm curious whether that's correct. There are definitely other concerns, such as whether this amount of flexibility is worth the potentially confusing configs it will make possible. If there are other examples of configs that would be nice to disable en masse, that'd also be interesting to discuss, but I think it's best to be more specific than "let's disable everything". For example, if you use |
So far I've disabled the colors and moved on. The problem with colors is that it's impossible to reset them after the fact due to way the selector priority works. Everything else seems easily overrideable, so not as important. To me this is a stop-gap measure. Not sure how long will it take to debate on the more proper system. Might be worth to land a env var to disable just the colors to unblock people like me and focus on whatever more pressing things. |
My preference would be not to merge the stop-gap measure as is. It feels a bit hacky, and it feels like this problem would only be urgent for a few people. Are you unable to use a custom version of I do think that this is a real issue that would be nice to solve, just not so urgent to be worth exposing everybody to a temporary stop-gap that will be very likely to lead to a breaking change later. See also #5571 (though if we go with something like themes, it might not actually be that relevant). |
Oh, and as a complete aside: the reason I first found
|
As a workaround, |
It might be nice for Jujutsu to respect |
It does, though it might not be obvious due to 3d41db1 . (I am not sure if I agree with that design, it certainly makes NO_COLOR not very useful for me, but apparently that's how it's supposed to work according to the spec. I've never relied on NO_COLOR, so I'm OK with it not being very useful to me even if I don't understand why the spec is this way. ) But I think the OP wants color, they just want color for exactly the things they specify and nothing else. |
My motivation is mostly to address jj-vcs#5098, even as a stopgap meassure.
b5a4577
to
b7bec6b
Compare
Exactly. I'm a very hard to please, opinionated and particular about everything. Just the worst kind of user really. |
My motivation is mostly to address #5098 , but in a lot of software there's a flag to disable sourcing default configs, which is useful in a lot contexts.
A more granular (or just atlernative/better) approaches would require more design and debate, while this seems simple and immediately useful (at least to some).
Checklist
If applicable:
CHANGELOG.md