From 6dc04d3f97b55d34bd0cfaab34aa674fdcce98d1 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sat, 28 Dec 2019 23:40:41 +0100 Subject: [PATCH] axzshctl: Enhance completions, include cloned modules Use ZSH globbing instead of calling external commands (like ls, cut and find), and include cloned repositories ("foreign modules") in the completions, too. --- core/50_axzsh/functions/_axzsh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/50_axzsh/functions/_axzsh b/core/50_axzsh/functions/_axzsh index bd83bfa..3c3d0c5 100644 --- a/core/50_axzsh/functions/_axzsh +++ b/core/50_axzsh/functions/_axzsh @@ -22,14 +22,15 @@ _axzshctl() { case "$words[2]" in "enable-plugin"|"disable-plugin") compadd "$@" -- \ - $(ls -1 "$AXZSH"/plugins) \ - $(ls -1 "$AXZSH"/custom_plugins) + "$AXZSH"/plugins/*(/:t) \ + "$AXZSH"/custom_plugins/*(N/:t) \ + "$AXZSH"/repos/*(/:t:s/#/\\/) ;; "set-theme") compadd "$@" -- "-" \ - $(ls -1 "$AXZSH"/themes | cut -d'.' -f1) \ - $(ls -1 "$AXZSH"/custom_themes | cut -d'.' -f1) \ - $(find "$AXZSH/custom_plugins" "$AXZSH/repos" -maxdepth 2 -iname '*.zsh-theme' -exec basename {} \; | cut -d'.' -f1) + "$AXZSH"/themes/*.axzshtheme(:r:t) \ + "$AXZSH"/custom_themes/*.axzshtheme(N:r:t) \ + "$AXZSH"/repos/*/*.zsh-theme(N:r:t) ;; esac ;; -- 2.39.2