Skip to content

Commit 15ec29d

Browse files
FUNCTIONAL: Use %q for printing array
This correctly quotes and escapes characters to be shell safe. This also requires wrapping the result in rather than '' to avoid problems with escaping single quotes.
1 parent 6765427 commit 15ec29d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

completion/available/aliases.completion.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ function _bash-it-component-completion-callback-on-init-aliases() {
9191
if [[ \$COMP_LINE == \"\$prec_word \$compl_word\" ]]; then
9292
prec_word='$alias_cmd $alias_args'
9393
prec_word=\${prec_word#* }
94-
fi
94+
fi:
9595
(( COMP_CWORD += ${#alias_arg_words[@]} ))
96-
COMP_WORDS=(\"$alias_cmd\" $(printf "'%s' " "${alias_arg_words[@]}") \"\${COMP_WORDS[@]:1}\")
96+
COMP_WORDS=(\"$alias_cmd\" $(printf "\"%q\" " "${alias_arg_words[@]}") \"\${COMP_WORDS[@]:1}\")
9797
(( COMP_POINT -= \${#COMP_LINE} ))
9898
COMP_LINE=\${COMP_LINE/$alias_name/$alias_cmd $alias_args}
9999
(( COMP_POINT += \${#COMP_LINE} ))

0 commit comments

Comments
 (0)