8000 [Console] Allow to override the command used to execute the application during autocompletion by tucksaun · Pull Request #57371 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] Allow to override the command used to execute the application during autocompletion #57371

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/Symfony/Component/Console/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.2
---

* Allow to override the command used to execute the application during autocompletion

7.1
---

Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Component/Console/Resources/completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ _sf_{{ COMMAND_NAME }}() {

# Use newline as only separator to allow space in completion values
IFS=$'\n'
local sf_cmd="${COMP_WORDS[0]}"
# _SF_CMD allows Symfony CLI to tell us to use a different command to run the console
local sf_cmd="${_SF_CMD:-${COMP_WORDS[0]}}"

# for an alias, get the real script behind it
sf_cmd_type=$(type -t $sf_cmd)
Expand Down
13 changes: 12 additions & 1 deletion src/Symfony/Component/Console/Resources/completion.fish
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@ function _sf_{{ COMMAND_NAME }}
set sf_cmd (commandline -o)
set c (count (commandline -oc))

set completecmd "$sf_cmd[1]" "_complete" "--no-interaction" "-sfish" "-a{{ VERSION }}"
# _SF_CMD allows Symfony CLI to tell us to use a different command to run the console
if set -q _SF_CMD; and test -n _SF_CMD
for i in $_SF_CMD
if [ $i != "" ]
set completecmd $completecmd "$i"
end
end
else
set completecmd $completecmd $sf_cmd[1]
end

set completecmd $completecmd "_complete" "--no-interaction" "-sfish" "-a{{ VERSION }}"

for i in $sf_cmd
if [ $i != "" ]
Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Component/Console/Resources/completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ _sf_{{ COMMAND_NAME }}() {
fi

# Prepare the command to obtain completions
requestComp="${words[0]} ${words[1]} _complete --no-interaction -szsh -a{{ VERSION }} -c$((CURRENT-1))" i=""
# _SF_CMD allows Symfony CLI to tell us to use a different command to run the console
requestComp="${words[0]} ${_SF_CMD:-${words[1]}} _complete --no-interaction -szsh -a{{ VERSION }} -c$((CURRENT-1))" i=""
for w in ${words[@]}; do
w=$(printf -- '%b' "$w")
# remove quotes from typed values
Expand Down
Loading
0