Skip to content

Commit b9ca44b

Browse files
committed
Rewrite missing bash-completion message
Makes the requirement for the bash-completion package clearer. Also inlines the check for a function from bash-completion rather than registering a variable in the user's shell unnecessarily. The message goes to stderr as it's an error message. Either way renders fine though.
1 parent cae8710 commit b9ca44b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/HookFactory.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,11 @@ function %%function_name%% {
6464
__ltrim_colon_completions "$cur";
6565
};
6666
67-
COMP_FOUND=`type -t _get_comp_words_by_ref`
68-
69-
if [ "$COMP_FOUND" == "function" ]; then
67+
if [ "$(type -t _get_comp_words_by_ref)" == "function" ]; then
7068
complete -F %%function_name%% "%%program_name%%";
7169
else
72-
echo "The 'bash-completion' package not found."
70+
>&2 echo "Completion was not registered for %%program_name%%:";
71+
>&2 echo "The 'bash-completion' package is required but doesn't appear to be installed.";
7372
fi
7473
END
7574

0 commit comments

Comments
 (0)