mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-09-02 15:17:24 -04:00
Do not auto-complete directories in shell completions (only entries)
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
#compdef mutn
|
||||
|
||||
mutn_path="$HOME/.local/share/libmutton"
|
||||
full_paths=("$mutn_path"/**/*)
|
||||
trimmed_paths=()
|
||||
for scan_path in "${full_paths[@]}"; do
|
||||
trimmed_paths+=("${scan_path#$mutn_path}")
|
||||
mutnPath="$HOME/.local/share/libmutton"
|
||||
fullPaths=("$mutnPath"/**/*)
|
||||
trimmedPaths=()
|
||||
for scanPath in "${fullPaths[@]}"; do
|
||||
# exclude directories
|
||||
[ -f "$scanPath" ] && trimmedPaths+=("${scanPath#$mutnPath}")
|
||||
done
|
||||
[[ -z $trimmed_paths ]] && trimmed_paths=(help)
|
||||
[[ -z $trimmedPaths ]] && trimmedPaths=(help)
|
||||
|
||||
case ${words[-2]} in
|
||||
mutn )
|
||||
compadd $trimmed_paths
|
||||
compadd $trimmedPaths
|
||||
;;
|
||||
/* )
|
||||
compadd {copy,edit,gen,add,shear}
|
||||
|
||||
Reference in New Issue
Block a user