8000 [Console] Handle alias in completion script by GromNaN · Pull Request #44475 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] Handle alias in completion script #44475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Handle alias in completion script
  • Loading branch information
GromNaN committed Dec 6, 2021
commit f3c196a03f0b2d9dadae0cf9f987f37512593ce0
6 changes: 6 additions & 0 deletions src/Symfony/Component/Console/Resources/completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ _sf_{{ COMMAND_NAME }}() {
# Use newline as only separator to allow space in completion values
IFS=$'\n'
local sf_cmd="${COMP_WORDS[0]}"

# for an alias, get the real script behind it
if [[ $(type -t $sf_cmd) == "alias" ]]; then
sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/")
fi

if [ ! -f "$sf_cmd" ]; then
return 1
fi
Expand Down
0