From 41c9d0a22b5bba67d3cb7ccff045f08a5bba3e70 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sat, 1 Apr 2023 23:19:56 -0400 Subject: [PATCH] Complete 'help' if the entry directory is empty or does not exist Former-commit-id: 1167f06b14ce50baa0c96e67a835247c6579aaa9 Former-commit-id: ea6be360d50c16579253d1e2d0b1825c5a1f1a4a --- extra/completion.bash | 1 + extra/completion.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/extra/completion.bash b/extra/completion.bash index b8b0ddc..be4783e 100755 --- a/extra/completion.bash +++ b/extra/completion.bash @@ -9,6 +9,7 @@ _path_gen() { for path in "${full_paths[@]}"; do trimmed_paths+=("${path:${#sshyp_path}:-4}") done + if [ "${trimmed_paths[0]}" == '/**/*' ]; then trimmed_paths[0]=help; fi } && _sshyp_completions() { diff --git a/extra/completion.zsh b/extra/completion.zsh index 9182de6..15382e8 100755 --- a/extra/completion.zsh +++ b/extra/completion.zsh @@ -5,6 +5,7 @@ full_paths=("$sshyp_path"/**/*.gpg) for scan_path in "${full_paths[@]}"; do trimmed_paths+=("${${scan_path#$sshyp_path}%????}") done +[[ -v trimmed_paths ]] || trimmed_paths=(help) case ${words[-2]} in sshyp )