Use more specific names for global variables in Bash and ZSH completions

This commit is contained in:
2024-07-16 18:35:31 -04:00
parent f0cdd217d9
commit 0fc0a2cfc0
3 changed files with 16 additions and 16 deletions
+7 -7
View File
@@ -1,17 +1,17 @@
#compdef mutn
mutnPath="$HOME/.local/share/libmutton"
fullPaths=("$mutnPath"/**/*)
trimmedPaths=()
for scanPath in "${fullPaths[@]}"; do
libmuttonEntryRoot="$HOME/.local/share/libmutton"
libmuttonFullPaths=("$libmuttonEntryRoot"/**/*)
libmuttonTrimmedPaths=()
for scanPath in "${libmuttonFullPaths[@]}"; do
# exclude directories
[ -f "$scanPath" ] && trimmedPaths+=("${scanPath#$mutnPath}")
[ -f "$scanPath" ] && libmuttonTrimmedPaths+=("${scanPath#$libmuttonEntryRoot}")
done
[[ -z $trimmedPaths ]] && trimmedPaths=(help)
[[ -z $libmuttonTrimmedPaths ]] && libmuttonTrimmedPaths=(help)
case ${words[-2]} in
mutn )
compadd $trimmedPaths
compadd $libmuttonTrimmedPaths
;;
/* )
compadd {copy,edit,gen,add,shear}