Skip to content
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

🐞 bug: zinit update breaks atclone file generation #172

Closed
jankatins opened this issue Jan 31, 2022 · 5 comments
Closed

🐞 bug: zinit update breaks atclone file generation #172

jankatins opened this issue Jan 31, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@jankatins
Copy link
Contributor

jankatins commented Jan 31, 2022

Issue description

I run zinit update and this breaks my starship setup as it seems the atclone stanza is not rerun after updating the program:

After an update via zsh -c "source ~/.zinit/bin/zinit.zsh && zinit update"

ls -la .zinit/plugins/starship---starship
total 5432
drwxr-xr-x 1 js js      46 Jan 31 12:36 .
drwxr-xr-x 1 js js    1006 Jan 30 13:58 ..
drwxr-xr-x 1 js js      50 Jan 31 12:36 ._backup
-rwxr-xr-x 1 js js 5561504 Jan 15 12:26 starship
drwxr-xr-x 1 js js     108 Jan  7 15:17 ._zinit

After rm -rf .zinit/plugins/starship---starship/ and opening a new terminal tab:

ls -la .zinit/plugins/starship---starship
total 5448
drwxr-xr-x 1 js js      80 Jan 31 12:43 .
drwxr-xr-x 1 js js    1006 Jan 31 12:43 ..
drwxr-xr-x 1 js js       0 Jan 31 12:43 ._backup
-rw-r--r-- 1 js js      89 Jan 31 12:43 init.zsh
-rw-r--r-- 1 js js   11305 Jan 31 12:43 _starship
-rwxr-xr-x 1 js js 5561504 Jan 15 12:26 starship
drwxr-xr-x 1 js js     108 Jan 31 12:43 ._zinit

zinit config

zinit wait lucid for \
          as"program" from"gh-r" \
          atclone"./starship init zsh > init.zsh; ./starship completions zsh > _starship" \
          atpull"%atclone" src"init.zsh" \
          load starship/starship

zinit version or commit ID

789eb02

zsh version

5.8

host info

CPUTYPE=x86_64 MACHTYPE=x86_64 XDG_SESSION_TYPE=wayland OSTYPE=linux-gnu 5.15.0-2-amd64 ID=debian

@jankatins jankatins added 🎲 triage bug Something isn't working labels Jan 31, 2022
@yodahuang
Copy link

This shall be the same bug as in #147

@smac89
Copy link

smac89 commented Feb 16, 2022

For me atclone seems to be running after the commands it is supposed to proceed.

For example trying to add stripe cli completion:

zi wait='1b' lucid light-mode for \
     id-as="stripe/completion" \
        as="completion" \
        has='stripe' \
        atclone="stripe completion --shell zsh" \
        mv="stripe-completion* -> _stripe" \
        atpull="%atclone" \
        blockf zdharma-continuum/null

The mv command will run before atclone is finished because it will complain that no files matched, but when the install is finished, you will find that the file is actually there

@zaggash
Copy link

zaggash commented Feb 27, 2022

I had the same issue for completion with atclone atpull and kubectl
The completion is not loading and stays uninstalled like in #147

I found a workaround:

  • Remove the current completion line then:
zinit delete --clean
zinit cclear
  • And add the new config
zinit wait lucid for \
  as"completion" https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker \
  as"completion" has"kubectl" id-as"kubectl--completion" atpull'%atclone' atclone"kubectl completion zsh > _kubectl; zinit creinstall -q kubectl--completion" run-atpull nocompile zdharma-continuum/null

Maybe it'll help someone.

@jankatins jankatins changed the title 🐞 bug: zinit update breaks atcone file generation 🐞 bug: zinit update breaks atclone file generation Feb 28, 2022
@vladdoster
Copy link
Member

vladdoster commented Mar 18, 2022

@smac89

For me atclone seems to be running after the commands it is supposed to proceed.

For example trying to add stripe cli completion:

zi wait='1b' lucid light-mode for \
     id-as="stripe/completion" \
        as="completion" \
        has='stripe' \
        atclone="stripe completion --shell zsh" \
        mv="stripe-completion* -> _stripe" \
        atpull="%atclone" \
        blockf zdharma-continuum/null

The mv command will run before atclone is finished because it will complain that no files matched, but when the install is finished, you will find that the file is actually there

You're overcomplicating things, look at stripe completion --help

zi for \
    as'completion' \
    atpull'%atclone' \
    blockf \
    from'gh-r' \
    nocompile \
    atclone"./stripe completion --shell zsh --write-to-stdout > _stripe" \
    sbin'stripe' \
  stripe/stripe-cli

Installing completion and zinit update --urge work fine.

An added benefit is it also installs the stripe cli binary, cool!

~/.local/share/zsh/zinit/plugins
ᐳ zi delete stripe/stripe-cli -y; exec zsh; zi report stripe/stripe-cli
bin-gem-node annex: Correctly removed the stripe shim from $ZPFX/bin

Done (action executed, exit code: 0)

Downloading stripe/stripe-cli…
(Requesting `stripe_1.8.1_linux_x86_64.tar.gz'…)
################################################################################################################################################################### 100.0%
ziextract: Unpacking the files from: `stripe_1.8.1_linux_x86_64.tar.gz'
ziextract: Successfully extracted and assigned +x chmod to the file: `stripe'.
bin-gem-node annex: Created the stripe shim and set +x on the stripe binary
Installed 1 completions. They are stored in the $INSTALLED_COMPS array.

~/.local/share/zsh/zinit/plugins
ᐳ zi report stripe/stripe-cli
Report for stripe/stripe-cli plugin
-----------------------------------

Completions:
_stripe [enabled]


~/.local/share/zsh/zinit/plugins

@jankatins
Copy link
Contributor Author

Given that I run my zinit update in a (non interactive) script, my original problem is (almost surely) fixed by #199 / #227. I'm closing this therefore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants