-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Automatically rebuild custom assets when necessary #2085
Comments
I did consider this when first implementing the above semver-incompatibility detection and error message. My only concern is that we can not know if the binary user assets and the source user assets are still "compatible". This might be a contrived case, but what I was thinking about is the following scenario:
I therefore opted for the explicit version rather than the implicit/automatic one. But I'm happy to reconsider this. I might have been a bit over-cautious. |
What if bat manages its caches transparently. Users should only have control over the plain configuration files. User behavior is governed by its config files. |
You mean bat should check the timestamp of each custom theme and custom syntax, and then compare that with the timestamp of the built custom assets (a.k.a. "the cache"), and if any asset is newer than the cache, then the cache is automatically rebuilt? I think that is a good solution. My only concern is what impact if would have on startup time. But we already today read the metadata file on each startup, so I suspect doing something akin to above would not have that big of an impact. If we can get that to work, we potentially could get rid of the I think it would also take care of the scenario you describe David, because as soon as the user "breaks" their custom assets, they would learn about it right away. (Or to be precise, the next time they invoke bat.) |
I'm not advocating for any solution in particular here. An actual solution should find a cached asset that semver matches the running bat, and source checksum also matches. If matching fails then rebuild and add or replace cache. I also linked dandavison/delta#1018 since other programs might depend on bat caches but support a different library version. IMO programs should not be sharing caches this way without a proper solution as outlined above. This is important as Rust doesn't support dynamic linking, in contrast to how C libraries would be packaged. I also appreciate |
I would like to suggest updating the completion scripts to prevent autocompleting the Imagine this situation (which gets me almost every day):
You can argue that this is user error on my part, or that my fingers are too fast for my own good (which could be true), but I would insist that the completion script is at fault here. The reason is simply that this behaviour is dissimilar to most other commonly-used tools (e.g. And in return for the constant frustration, the benefit is clearly minimal. The Therefore I think it's a good idea to remove it right now from all completion scripts. Should be only a few lines of deletion. If people agree with this opinion then I'm happy to go ahead and create a PR. P.s. I'm only suggesting the removal of the autocompletion of the word |
I personally have no objections. |
big +1, this would be a huge improvement in usability – thank you! |
Currently, if a user makes use of custom assets and then installs a new 0.x.0 version of bat, bat will stop working. That is not an ideal user experience. It would be good if we could make this use case smoother, e.g. by automatically doing the equivalent of running
bat cache --build
for the user.Step-by-step
Here is a step by step against the git repo, but regular users will get this problem too via regular releases from us and e.g. package manager updates of the bat app.
cargo run -- cache --build --blank --source assets
Cargo.toml
, e.g. from 0.19.0 to 0.20.0cargo run -- examples/simple.rs
Expected result
bat prints
examples/simple.rs
Actual result
The text was updated successfully, but these errors were encountered: