zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
3.2k stars 129 forks source link

[feat]: Allow specifying parts of a version #641

Open jankatins opened 9 months ago

jankatins commented 9 months ago

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 trying to install the bitwarden clie from https://github.com/bitwarden/clients/releases. Unfortunately, bitwarden mixes the releases for all their clients and I only want to consider the releases with a tag like cli-* (at the time of writing this: cli-v2024.2.0.

Describe the proposed feature.

Currently the 'ver' ICE is used verbatim. It would be nice if it could be used as prefix or regex.

Describe alternatives you've considered

zinit would fall back to an older release until a bpick is matching.

Additional context

Currently this error is shown, when using the folliwng recipe:

zinit default-ice --quiet as'null' from"gh-r" lbin'!' lucid nocompile completions
zinit lbin'!bw' bpick"bw-*.zip" ver'cli-' for @bitwarden/clients
==> Downloading bitwarden/clients
Error: gh-r: bpick ice found no release assets To fix, modify the bpick glob pattern bw-*.zip
Error: gh-r: No GitHub release assets found for cli-

If I use a full ver, it works:

zinit lbin'!bw' bpick"bw-*.zip" ver'cli-v2024.2.0' for @bitwarden/clients
==> Downloading bitwarden/clients
==> Requesting bw-macos-2024.2.0.zip
#=#=-  #       #                                                                                                                                                                                                                                               #=O#-     #        #                                           ######################################################################################################################################################################################################################################################### 100.0%
[ziextract] Unpacking the files from: `bw-macos-2024.2.0.zip'…
[ziextract] Successfully extracted and assigned +x chmod to the file: bw.
==> linkbin: Created bw soft link & set +x on the bw binary

Related Issues

No response

jankatins commented 9 months ago

Another alternative: use a dynamic version: I get the current version with curl -s -L -H "Accept: application/vnd.github+json" https://api.github.com/repos/bitwarden/clients/releases | jq -c '[.[] | select(.tag_name | contains("cli-"))] | .[0].tag_name', so if zinit update would run that again, all would be fine :-)