zinit
zinit copied to clipboard
[feat]: Synchronous install and updates
If the feature request is for a plugin or theme, specify it here.
No response
If the feature solves a problem you have, specify it here.
I'm always frustrated when I try to perform a headless update or install and my turbo-mode plugins cause the calling process to return early.
Describe the proposed feature.
A --sync
mode for plug-in update and plug-in installs that disables the wait
ice modifier for that session.
Describe alternatives you've considered
Maintaining two plug-in manifests: one for loading the shell asynchronously for user input; one for sync updates and installs for automated management. The latter would have the wait
statements removed.
Additional context
Perhaps i misunderstand wait
, perhaps there is a means to do it that I have overlooked.
Related Issues
No response
@xbc5 Could you elaborate with an example (e.g., a code snippet) to help me better understand this request?
I will do further testing and get back to you on this. I will close this issue for now and reopen once I know more and if there's still a need for it.
Perhaps I misunderstand how wait
actually works. So perhaps with an example you may see what I am misunderstanding.
Here is my installation script for reference.
In Short
An environment variable that disables wait, so that I can use the same script for a headless installation, and loading, without it exiting early:
# CLI
ZINIT_SYNC=true my-init-script.sh # proposed feature
# my-init-script.sh
zinit ice wait # wait disabled
zinit light foo/bar # is synchronously installed, no wait
zinit ice wait from"gh-r" as"program" # wait disabled; still pulled from GH releases
zinit light bar/baz # is synchronous
Detail
This both installs and asynchronously loads plug-ins:
zinit ice wait
zinit light foo/bar
It serves a dual purpose.
wait
is great for loading, but not always great for installing. In my particular use case I am using SaltStack to provision my machine. I am trying to "script" the installation of the plug-ins, but wait
seems to interfere (causes early exit).
If I take out the wait
for all plug-ins:
zinit light foo/bar
Then all plug-ins get installed successfully. I am assuming it's because the installation script doesn't exit too early.
The feature I have requested disables wait
with a ~command line switch~ environment variable, such that running zinit ice wait
is not longer asynchronous.
Justification
I have to create two scripts: one synchronous for installation and updates (without wait); one asynchronous for loading (with wait). Alternatively, I could create complex logic to skirt around the issue (but I won't bore you with the details).
The environment variable is a better option because if you look at my installation script as an example, there are a number of zinit
statements, and passing an argument to them all isn't an easy way to switch between synchronous and asynchronous. Although it would suffice, it's just not ideal.
Thank you for taking the time to read.
There is a way to make scheduler execute all plugins early, during zshrc load. I cannot recall now, but maybe @robobenklein will be able to share the method?
Indeed, it is in the code at https://github.com/zdharma-continuum/zinit/blob/68f8f1d3cbd7b22c2b45990b108d6c89f83d61d9/zinit.zsh#L2376-L2380 and I use it in my Dockerfile as zsh -i -c -- '@zinit-scheduler burst'
I missed that one. I will check it out later, and if all is well I will close the issue. Thanks.
@xbc5,
Can this be closed?
I haven't tested it vladdoster, let me test it over the next few days/week and I will close it for you.