Made Bash completions significantly faster, temporarily ensure recursive globbing is enabled

Former-commit-id: c974ce1e0cb0198094d6ece325ab3216f1925f36
Former-commit-id: 762562fbbdb298f4b13210d0014a942b430c1197
This commit is contained in:
2023-03-08 23:00:53 -05:00
parent 843dff6527
commit 648bed832f
+5 -4
View File
@@ -2,11 +2,12 @@
_path_gen() { _path_gen() {
local sshyp_path="$HOME/.local/share/sshyp" local sshyp_path="$HOME/.local/share/sshyp"
local sshyp_path_length="$(("${#sshyp_path}" + 1))" local glob_status=$(shopt -p globstar)
full_paths=(~/.local/share/sshyp/**/*.gpg) [ -z "${glob_status##*u*}" ] && shopt -s globstar # if recursive globbing is disabled, enable it
full_paths=("$sshyp_path"/**/*.gpg)
$glob_status # set recursive globbing to user default
for path in "${full_paths[@]}"; do for path in "${full_paths[@]}"; do
trimmed_path=$(echo ${path%????} | cut -c"$sshyp_path_length"-) trimmed_paths+=("${path:${#sshyp_path}:-4}")
trimmed_paths+=("$trimmed_path")
done done
} && } &&