From 4904d0fc6b09388d7f39dc5251079cc8f33fb149 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 29 Sep 2025 23:19:10 +1300 Subject: [PATCH] Update whatsdirty --- whatsdirty | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/whatsdirty b/whatsdirty index cb7c0a6..fd9f8f3 100755 --- a/whatsdirty +++ b/whatsdirty @@ -261,8 +261,13 @@ main() { # === Autocomplete Function === handle_autocomplete() { + # Ensure COMP_WORDS and COMP_CWORD are set + if [ -z "${COMP_WORDS+x}" ] || [ -z "${COMP_CWORD+x}" ]; then + return 0 + fi + local cur_word="${COMP_WORDS[COMP_CWORD]}" - + # If we're completing the first argument after 'whatsdirty' if [ ${COMP_CWORD} -eq 1 ]; then # Suggest common directories and saved directory