[READ-ONLY] Mirror of https://github.com/bombshell-dev/tab. shell autocompletions for javascript CLIs
4

Configure Feed

Select the types of activity you want to include in your feed.

fix: quote arguments for passing to auto completion server (#20)

authored by

kazuya kawaguchi and committed by
GitHub
(Apr 5, 2025, 3:23 PM +0100) 820a3d65 d5659d51

+9 -3
+9 -3
src/zsh.ts
··· 46 46 flagPrefix="-P \${BASH_REMATCH}" 47 47 fi 48 48 49 - # Prepare the command to obtain completions 50 - requestComp="${exec} complete -- \${words[2,-1]}" 49 + # Prepare the command to obtain completions, ensuring arguments are quoted for eval 50 + local -a args_to_quote=("\${(@)words[2,-1]}") 51 51 if [ "\${lastChar}" = "" ]; then 52 52 # If the last parameter is complete (there is a space following it) 53 53 # We add an extra empty parameter so we can indicate this to the go completion code. 54 54 __${name}_debug "Adding extra empty parameter" 55 - requestComp="\${requestComp} ''" 55 + args_to_quote+=("") 56 56 fi 57 + 58 + # Use Zsh's (q) flag to quote each argument safely for eval 59 + local quoted_args=("\${(@q)args_to_quote}") 60 + 61 + # Join the main command and the quoted arguments into a single string for eval 62 + requestComp="${exec} complete -- \${quoted_args[*]}" 57 63 58 64 __${name}_debug "About to call: eval \${requestComp}" 59 65