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

[Console] Bash completion integration #15947

Closed
fabpot opened this issue Oct 19, 2021 · 6 comments · Fixed by #16723
Closed

[Console] Bash completion integration #15947

fabpot opened this issue Oct 19, 2021 · 6 comments · Fixed by #16723
Labels
Milestone

Comments

@fabpot
Copy link
Member

fabpot commented Oct 19, 2021

Q A
Feature PR symfony/symfony#42251
PR author(s) @wouterj
Merged in 5.4
@fabpot fabpot added this to the 5.4 milestone Oct 19, 2021
@dkarlovi
Copy link
Contributor

Topics which make sense (to me) here:

End users

  1. installing/updating the completion script (all supported systems)

Devs

  1. adding completion to your own Symfony commands (when a regular Symfony app, bin/console scenario)
  2. adding completion to your own CLI apps (when using standalone apps, behat or composer scenario) + how to instruct their own end users to enable & use it
  3. debugging the current completion script (built in debugger)
  4. signaling completion script update required to the end user (version check)
  5. something for packagers (like if Composer was packaged into a RPM / DEB, how would the packager get the completion script to package with it, maybe some overlap with 2. here)

@GromNaN
Copy link
Member

GromNaN commented Jan 5, 2022

This comment is descriptive enough for debugging, and can be transferred into the doc: symfony/symfony#43594 (comment)

@LukeTowers
Copy link

How would I go about adding autocompletion support to a project that uses symfony/console (i.e. Winter CMS, which is built on Laravel)? Is there something that users need to run in their terminals in order to be able to send and receive the autocomplete information when interacting with the CLI entrypoint of our application (artisan in this case)? Is there anything that I need to add to the CLI entrypoint in order to make it work correctly? Can I just add a complete() method to my commands and be off to the races?

Is anyone able to help point me in the right directions for the above questions? This feature looks pretty amazing and I'm super excited to start using it; just need a bit of help to get started :)

@LukeTowers
Copy link

I noticed autocompletion for Laravel was being demoed in the blog post, but I can't seem to find any indication of it being present in Laravel nor how to add it.

@wouterj
Copy link
Member

wouterj commented Feb 15, 2022

@LukeTowers if the application uses symfony/console 5.4+, you can read the set-up instructions in artisan completion --help

You need to install a bash script (provided by this command) and then you'll automatically have completion support for command names and options.

@LukeTowers
Copy link

@wouterj thanks so much, that works absolutely fantastically! I'm so excited to add support for this to @wintercms :)

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

Successfully merging a pull request may close this issue.

6 participants