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 060d328

Browse filesBrowse files
committed
bug #44475 [Console] Handle alias in completion script (GromNaN)
This PR was merged into the 5.4 branch. Discussion ---------- [Console] Handle alias in completion script | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #44461 | License | MIT | Doc PR | - Detect when completion is triggered by an alias and get the underlying command. Tip extracted from [bamarni/symfony-console-autocomplete](https://github.com/bamarni/symfony-console-autocomplete/blob/v1.4.2/resources/bash/default.php#L7-L10). Works well with such alias: ```console alias console=bin/console ``` Doesn't work with these aliases (command name is not the 1st part of the alias): ```console alias console='APP_ENV=test bin/console' ``` When alias has a different name, the name in the completion script must be updated. Commits ------- f3c196a Handle alias in completion script
2 parents cbebf57 + f3c196a commit 060d328
Copy full SHA for 060d328

File tree

Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Resources/completion.bash
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ _sf_{{ COMMAND_NAME }}() {
99
# Use newline as only separator to allow space in completion values
1010
IFS=$'\n'
1111
local sf_cmd="${COMP_WORDS[0]}"
12+
13+
# for an alias, get the real script behind it
14+
if [[ $(type -t $sf_cmd) == "alias" ]]; then
15+
sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/")
16+
fi
17+
1218
if [ ! -f "$sf_cmd" ]; then
1319
return 1
1420
fi

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.