8000 [Console] Support completion for bash functions by Chi-teck · Pull Request #48179 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
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
Support completion for bash functions
  • Loading branch information
Chi-teck authored and fabpot committed Nov 19, 2022
commit 13212789fdd454f5415fe8a096dc8b01bfa3e706
7 changes: 4 additions & 3 deletions src/Symfony/Component/Console/Resources/completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ _sf_{{ COMMAND_NAME }}() {
local sf_cmd="${COMP_WORDS[0]}"

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

if [ ! -x "$sf_cmd" ]; then
if [[ $sf_cmd_type != "function" && ! -x $sf_cmd ]]; then
return 1
fi

Expand Down
0