Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5882b4f

Browse filesBrowse files
committed
bug #48179 [Console] Support completion for bash functions (Chi-teck)
This PR was submitted for the 6.2 branch but it was merged into the 5.4 branch instead. Discussion ---------- [Console] Support completion for bash functions | Q | A | ------------- | --- | Branch | 6.2 | Bug fix? | no | New feature | yes | Deprecations | no | License | MIT I often use bash functions as wrappers for executable files that live in vendor/bin. So that they can be executed from any location within a project. Symfony Console has recently added support for Bash completions but right now that only applies to executable files and aliases. This PR adds support for Bash functions. Commits ------- 1321278 Support completion for bash functions
2 parents d4fab7f + 1321278 commit 5882b4f
Copy full SHA for 5882b4f

File tree

1 file changed

+4
-3
lines changed
Filter options

1 file changed

+4
-3
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Resources/completion.bash
+4-3Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.