Properly reset trimmed_paths for zsh completion

Former-commit-id: adda3df4ca4afbc7da162fb64592e853617802d4
Former-commit-id: 96917ce98bef0c879f392a2444f6d600589d9b53
This commit is contained in:
2023-04-01 23:44:22 -04:00
parent 41c9d0a22b
commit 0c85703a73
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -6,8 +6,8 @@ _path_gen() {
[ -z "${glob_status##*u*}" ] && shopt -s globstar # if recursive globbing is disabled, enable it
local full_paths=("$sshyp_path"/**/*.gpg)
$glob_status # set recursive globbing to user default
for path in "${full_paths[@]}"; do
trimmed_paths+=("${path:${#sshyp_path}:-4}")
for scan_path in "${full_paths[@]}"; do
trimmed_paths+=("${scan_path:${#sshyp_path}:-4}")
done
if [ "${trimmed_paths[0]}" == '/**/*' ]; then trimmed_paths[0]=help; fi
} &&
+2 -1
View File
@@ -2,10 +2,11 @@
sshyp_path="$HOME/.local/share/sshyp"
full_paths=("$sshyp_path"/**/*.gpg)
trimmed_paths=()
for scan_path in "${full_paths[@]}"; do
trimmed_paths+=("${${scan_path#$sshyp_path}%????}")
done
[[ -v trimmed_paths ]] || trimmed_paths=(help)
[[ -z $trimmed_paths ]] && trimmed_paths=(help)
case ${words[-2]} in
sshyp )