From 0566a380942f5e743534153889a99cccf0f63a89 Mon Sep 17 00:00:00 2001 From: Emily Marigold Klassen Date: Tue, 12 Jan 2021 13:44:57 -0800 Subject: [PATCH] perf: dont duplicate work when loading global binaries --- zsh-nvm.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zsh-nvm.plugin.zsh b/zsh-nvm.plugin.zsh index d85e94c..828be1a 100644 --- a/zsh-nvm.plugin.zsh +++ b/zsh-nvm.plugin.zsh @@ -25,11 +25,11 @@ _zsh_nvm_install() { _zsh_nvm_global_binaries() { # Look for global binaries - local global_binary_paths="$(echo "$NVM_DIR"/v0*/bin/*(N) "$NVM_DIR"/versions/*/*/bin/*(N))" + local global_binary_paths=($(echo "$NVM_DIR"/v0*/bin/*(N) "$NVM_DIR"/versions/*/*/bin/*(N))) # If we have some, format them if [[ -n "$global_binary_paths" ]]; then - echo "$NVM_DIR"/v0*/bin/*(N) "$NVM_DIR"/versions/*/*/bin/*(N) | + echo ${(F)global_binary_paths} | xargs -n 1 basename | sort | uniq