8000 feat: native autocomplete for `console` and `composer` by tucksaun · Pull Request #493 · symfony-cli/symfony-cli · GitHub
[go: up one dir, main page]

Skip to content

feat: native autocomplete for console and composer #493

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

Merged
merged 2 commits into from
Jul 12, 2024

Conversation

tucksaun
Copy link
Member
@tucksaun tucksaun commented Jul 1, 2024

This PR adds « native » autocompletion for console and composer commands.

By « native » I mean that this replaces the need for some shell sorcery (effectively replacing symfony/symfony#57371).

In order to make this work I partially ported the Symfony shell autocompletion wrapper code in go, where I prepare what is necessary to call Symfony’s (or Composer) _complete command.

Marking as draft while I open the PR to console about GuessShell

@tucksaun tucksaun force-pushed the feat/native-autocomplete-console branch from 58824ce to db7d613 Compare July 1, 2024 11:30
@tucksaun tucksaun marked this pull request as ready for review July 1, 2024 11:30
@fabpot
Copy link
Contributor
fabpot commented Jul 1, 2024

Testing on Fish. If bin/console does not exist, I get ./symfony console Could not open input file: bin/console.
Everything else looks good to me on Fish.

@tucksaun
Copy link
Member Author

@fabpot thank you for the feedback. I remember implementing a check for this at some point but I guess I dropped it by mistake during some refacto 🤷 . Going to have a look this week.

@tucksaun
Copy link
Member Author

@fabpot I just pushed a fix when I now properly check for the bin/console (or app/console) presence in the SymfonyExecutor. This also allows me to display an nice error when running symfony console outside of a Symfony project.

Currently:
Screenshot 2024-07-12 at 13 16 21

After:
Screenshot 2024-07-12 at 13 17 11

@fabpot fabpot merged commit 0a72133 into symfony-cli:main Jul 12, 2024
1 check passed
@fabpot
Copy link
Contributor
fabpot commented Jul 12, 2024

Thank you @tucksaun

@tucksaun tucksaun deleted the feat/native-autocomplete-console branch July 12, 2024 14:54
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Jul 22, 2024
This PR was submitted for the 7.1 branch but it was merged into the 5.4 branch instead.

Discussion
----------

Document Symfony CLI autocompletion

I recently implemented autocompletion for any tools based on [symfony-cli/console](https://github.com/symfony-cli/console) including Symfony CLI (see symfony-cli/console#11).
I also added completion forwarding for `composer` and `console` (see symfony-cli/symfony-cli#493).

This means that you can have the autocompletion for the 3 tools by following `symfony completion --help` instructions and that it will automatically use the right configuration (ie. PHP version, `php.ini`, etc) when running it.

Note: I opened the PR against `7.1` but technically this is not related to any `Symfony version`, let me know if you want me to change the target version.

Commits
-------

52f1f00 Document Symfony CLI autocompletion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0