8000 Support completion for bash functions · symfony/symfony@1321278 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1321278

Browse files
Chi-teckfabpot
authored andcommitted
Support completion for bash functions
1 parent d4fab7f commit 1321278

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Symfony/Component/Console/Resources/completion.bash

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ _sf_{{ COMMAND_NAME }}() {
1111
local sf_cmd="${COMP_WORDS[0]}"
1212

1313
# for an alias, get the real script behind it
14-
if [[ $(type -t $sf_cmd) == "alias" ]]; then
14+
sf_cmd_type=$(type -t $sf_cmd)
15+
if [[ $sf_cmd_type == "alias" ]]; then
1516
sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/")
16-
else
17+
elif [[ $sf_cmd_type == "file" ]]; then
1718
sf_cmd=$(type -p $sf_cmd)
1819
fi
1920

20-
if [ ! -x "$sf_cmd" ]; then
21+
if [[ $sf_cmd_type != "function" && ! -x $sf_cmd ]]; then
2122
return 1
2223
fi
2324

0 commit comments

Comments
 (0)
0