8000 [Console] Allow Symfony CLI to override how the console should be exe… · symfony/symfony@e1b4638 · GitHub
[go: up one dir, main page]

Skip to content

Commit e1b4638

Browse files
committed
[Console] Allow Symfony CLI to override how the console should be executed during autocompletion
1 parent ee63ef5 commit e1b4638

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

src/Symfony/Component/Console/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.2
5+
---
6+
7+
* Allow to override the command used to execute the application during autocompletion
8+
49
7.1
510
---
611

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ _sf_{{ COMMAND_NAME }}() {
1818

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

2324
# for an alias, get the real script behind it
2425
sf_cmd_type=$(type -t $sf_cmd)

src/Symfony/Component/Console/Resources/completion.fish

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,19 @@ function _sf_{{ COMMAND_NAME }}
99
set sf_cmd (commandline -o)
1010
set c (count (commandline -oc))
1111

12-
set completecmd "$sf_cmd[1]" "_complete" "--no-interaction" "-sfish" "-a{{ VERSION }}"
12+
# _SF_CMD allows Symfony CLI to tell us to use a different command to run the console
13+
if set -q _SF_CMD; and test -n _SF_CMD
14+
for i in $_SF_CMD
15+
if [ $i != "" ]
16+
set completecmd $completecmd "$i"
17+
end
18+
end
19+
set c (math $c - 1)
20+
else
21+
set completecmd $completecmd $sf_cmd[1]
22+
end
23+
24+
set completecmd $completecmd "_complete" "--no-interaction" "-sfish" "-a{{ VERSION }}"
1325

1426
for i in $sf_cmd
1527
if [ $i != "" ]

src/Symfony/Component/Console/Resources/completion.zsh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ _sf_{{ COMMAND_NAME }}() {
3333
fi
3434

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

0 commit comments

Comments
 (0)
0