Sort shell completions scripts into folders so that their intended names can be used

This commit is contained in:
2024-07-07 23:04:53 -04:00
parent ff6f5da824
commit 2ab833b91f
4 changed files with 1 additions and 1 deletions
+31
View File
@@ -0,0 +1,31 @@
#compdef mutn
mutnPath="$HOME/.local/share/libmutton"
fullPaths=("$mutnPath"/**/*)
trimmedPaths=()
for scanPath in "${fullPaths[@]}"; do
# exclude directories
[ -f "$scanPath" ] && trimmedPaths+=("${scanPath#$mutnPath}")
done
[[ -z $trimmedPaths ]] && trimmedPaths=(help)
case ${words[-2]} in
mutn )
compadd $trimmedPaths
;;
/* )
compadd {copy,edit,gen,add,shear}
;;
add )
compadd {password,note,folder}
;;
copy )
compadd {password,username,totp,url,note}
;;
edit )
compadd {password,username,totp,url,note,rename}
;;
gen )
compadd update
;;
esac