Skip to content

Commit

Permalink
perf(template): kc_asdf_tags_list_installed now support first args as…
Browse files Browse the repository at this point in the history
… version filtering
  • Loading branch information
kamontat committed Jul 31, 2024
1 parent 0b0ea3a commit b5a9a0c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ kc_asdf_tags_list() {

## List all installed tags from install directory
## usage: `output_file="$(kc_asdf_tags_list_installed)"`
## usage: `output_file="$(kc_asdf_tags_list_installed "^1")"`
kc_asdf_tags_list_installed() {
local ns="tags-list-installed.addon"
local install_path install
local install_path install regex="${1:-.*}"
printf -v install_path "%s/installs/%s" \
"$KC_ASDF_CORE_PATH" \
"$KC_ASDF_PLUGIN_NAME"
Expand All @@ -47,7 +48,8 @@ kc_asdf_tags_list_installed() {
for install in "$install_path"/*/; do
[[ -e $install ]] || break

basename "$install" | sed 's/^ref-/ref:/' >"$output"
[[ "$install" =~ $regex ]] &&
basename "$install" | sed 's/^ref-/ref:/' >"$output"
done
printf "%s" "$output"
else
Expand Down

0 comments on commit b5a9a0c

Please sign in to comment.