Skip to content

[feat]: doOnce with retry #289

@xenoterracide

Description

@xenoterracide

Feature description

if a portion of an ice command fails

Related Code

so I have this code, as an example

  zi ice lucid wait \
    cloneonly nocompile notify \
    atclone"install --compare -D after/syntax/zsh.vim $VIM_AFTER_SYNTAX/zsh.vim" \
    atpull"%atclone"
  zi light z-shell/zinit-vim-syntax

the problem is that this requires GNU install. Now I can test for that in various ways, and have actually updated my code to do so in a mac environment. Before this though I just ran this code and it would work if brew (or something) had already put it on the PATH. I'd always run this code, but after an initial setup of ZI if gnu install wasn't there at a shell launch I'd have to blow away ~/.zi and run this again. I don't want to run this every time I load the shell so doing atload is out of the question. Instead what I've done is duplicated this code and checked for gnu install.

  zi ice lucid wait'[[ -f $(brew --prefix coreutils)/libexec/gnubin/install ]]' \
    cloneonly nocompile notify \
    atclone"install --compare -D after/syntax/zsh.vim $VIM_AFTER_SYNTAX/zsh.vim" \
    atpull"%atclone"
  zi light z-shell/zinit-vim-syntax

while this works for this case I'd much rather simply retry the operation on a subsequent run if it didn't work this time.

As a continuation use case

zi ice lucid wait has'asdf' atclone'asdf plugin add nodejs' for z-shell/null

doesn't seem to work I expect this is because of how the atClone cycle works

I think these could be better done like this

zi ice lucid wait retry doonce'install --compare -D after/syntax/zsh.vim $VIM_AFTER_SYNTAX/zsh.vim'
zi ice lucid wait retry has'asdf' doonce'asdf plugin add nodejs'

I would not have has returning false mark the doonce as done.

Additional Context

No response

Self-service

  • I'd be willing to address this documentation request myself.

Have you read the Contributing Guidelines?

Are you familiar with the Contributor Covenant Code of Conduct?

Contact Details

[email protected]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

🆕 New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions