Skip to content
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

Study auto completion #56

Open
nenes25 opened this issue Jun 26, 2020 · 3 comments
Open

Study auto completion #56

nenes25 opened this issue Jun 26, 2020 · 3 comments
Assignees

Comments

@nenes25
Copy link
Member

nenes25 commented Jun 26, 2020

Check if it is possible to implement autocompletion
Thanks to @SebSept idea : https://github.com/stecman/symfony-console-completion
If not what about a pull request on PS projetct ?

@SebSept
Copy link
Contributor

SebSept commented Apr 9, 2021

Autocompletion depend on the shell (bash, zsh, fish, ...) and require operation on the user's machine file.
It might be a bit complicated to submit this to the PS project... Maybe not, I'm not used to contribute du Prestashop core.

@SebSept
Copy link
Contributor

SebSept commented Apr 9, 2021

Inspired by the zsh robo plugin.
I managed to have autocompletion running 😄 (commands only, not arguments/parameters)
with this :
create file fop_compl.sh :

_fop_get_command_list () {
    php72 ./bin/console --no-ansi | sed "1,/Available commands/d" | awk '/ ([a-z]+)/ { print $1 }'
}

_fop () {
        compadd `_fop_get_command_list`
}

compdef _fop php72 ./bin/console
source fop_compl.sh

No change in fop_console code required. It works.

Note : For a daily usage, it should be linked/sourced in the ~/.zshrc (via plugin maybe).
This example runs on my machine where I have multilple php binaries. You may need to replace php72 with php.


However, using https://github.com/stecman/symfony-console-completion may be a better choice because of arguments completion.
But it requires fop_console commands to implement special methods for arguments completion.
(and also a user system modification (for sourcing)).

@SebSept
Copy link
Contributor

SebSept commented Nov 12, 2021

By the way, Symfony 5.4 & 6.0 will have autocompletion.
https://symfony.com/blog/new-in-symfony-5-4-console-autocompletion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants