From 2d1c44cd318a04995cb2fa92c60bf3f170d5921b Mon Sep 17 00:00:00 2001 From: "kwhk_gogpu@gangdong" Date: Mon, 23 Feb 2026 19:32:11 +0900 Subject: [PATCH] autocompletion.bash| --- autocompletion.bash | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/autocompletion.bash b/autocompletion.bash index fa7fd18..533bb12 100644 --- a/autocompletion.bash +++ b/autocompletion.bash @@ -1,11 +1,13 @@ -#_git_pad() { -# __gitcomp "init edit status commit comment log list show search remove clone track remote push pull fetch merge version" -#} - _git_pad () { local cur prev words cword - _init_completion || return + + # Manually initialize completion variables for portability + # across Linux, macOS, and Git Bash (Windows). + words=("${COMP_WORDS[@]}") + cword=$COMP_CWORD + cur="${COMP_WORDS[$COMP_CWORD]}" + prev="${COMP_WORDS[$(( COMP_CWORD - 1 ))]}" local subcommands="init edit status commit comment log list show search remove clone track remote push pull fetch merge version" @@ -17,16 +19,11 @@ _git_pad () case "${words[2]}" in edit|show|comment) - #local common_dir="$(__git_common_dir)" || return local common_dir="$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")" local pad_dir="$common_dir/.git-pad/issues" - + [[ -d "$pad_dir" ]] || return - - # # Complete filenames from $pad_dir - # local IFS=$'\n' - # local files=( $(cd "$pad_dir" && printf '%s\n' *.md) ) - + local files=() while IFS= read -r f; do files+=( "${f%.md}" ) @@ -35,4 +32,4 @@ _git_pad () __gitcomp "${files[*]}" ;; esac -} +} \ No newline at end of file -- 2.51.2