Last active
November 16, 2023 01:09
-
-
Save unique1984/3d8ebc8c7b9b33162bb6dd7801be6128 to your computer and use it in GitHub Desktop.
Symfony Cli bash-completion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_symfony() | |
{ | |
local cur=${COMP_WORDS[COMP_CWORD]} | |
local cmd="${COMP_WORDS[0]}" | |
if ($cmd > /dev/null 2>&1) | |
then | |
COMPREPLY=($(compgen -W "$($cmd --help --no-ansi | grep -v 'Available\|Global\|Usage:\|Runs\|Environment' | grep ':' | awk '{print $1}' | grep -Poi '^\K[\w:-]+') new serve server:stop security:check composer console login link projects envs env:create tunnel:open ssh deploy domains vars user:add help" -- $cur)) | |
fi | |
} | |
complete -F _symfony symfony |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Found the problems!
grep -v 'Available\|Global\|Usage:'
-->grep -v 'Available\|Global\|Usage:\|Runs\|Environment'
grep -Poi '^\K[\w-:]+'
-->grep -Poi '^\K[\w:-]+'
for 2nd part -> stackoverflow grep -