Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] Implement completion for zsh #43592

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

Closed
stof opened this issue Oct 19, 2021 · 9 comments · Fixed by #47018
Closed

[Console] Implement completion for zsh #43592

stof opened this issue Oct 19, 2021 · 9 comments · Fixed by #47018
Labels
Console Feature Help wanted Issues and PRs which are looking for volunteers to complete them. Keep open

Comments

@stof
Copy link
Member

stof commented Oct 19, 2021

Bash completion was implemented in #42251

It would be great to have support for zsh as well.

@stof stof added the Help wanted Issues and PRs which are looking for volunteers to complete them. label Oct 19, 2021
@stof stof added the Feature label Oct 19, 2021
@fabpot
Copy link
Member

fabpot commented Oct 19, 2021

fish would be awesome (as this is what I'm using :))

@stof
Copy link
Member Author

stof commented Oct 19, 2021

@fabpot I suggest creating a separate issue asking for help for it (so that different people can work on them, and they can each get closed when they are implemented)

@reypm
Copy link

reypm commented Oct 20, 2021

@stof does not the implementation for bash works for zsh as well as per this line here: https://github.com/symfony/symfony/pull/42251/files#diff-413f288275127b30e381048947488a84bdd0f09e48080c647ba2896db4431e6aR43 ? also - maybe not related - but would be nice to create a new plugin for OhMyZsh (pretty sure a lot of us use it) for the newest Symfony versions.

@wouterj
Copy link
Member

wouterj commented Oct 20, 2021

@adhocore is working on a zsh implementation :)

@adhocore
Copy link
Contributor

adhocore commented Oct 20, 2021

more like trying to work on it hehe :)

two approaches:

  • generic auto-completer: for cmd and options list it could literally generate list of commands and options on the fly by parsing the list/help output and then for the contextual option values it can delegate to the capability of each of the command to supply the list
  • compiled auto-completer: one time manual generation of auto-completable lists of commands and options in zsh format something similar to how cobra does. while this seems complex than the previous one, it can make use of architecture already done by @wouterj but for zsh land

@stof
Copy link
Member Author

stof commented Oct 20, 2021

@adhocore the idea is to rely on the architecture done by @wouterj, so that the same code in Command::complete() can work for all shells. We don't want devs to implement 2 or 3 different ways to provide completion (the differences between zsh and bash should be handled in symfony/console)

@dkarlovi
Copy link
Contributor

@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@weitzman
Copy link

Yes, @carsonbot

@carsonbot carsonbot removed the Stalled label Apr 21, 2022
@fabpot fabpot closed this as completed Jul 22, 2022
fabpot added a commit that referenced this issue Jul 22, 2022
This PR was merged into the 6.2 branch.

Discussion
----------

[Console] Zsh shell autocompletion

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #43592
| License       | MIT
| Doc PR        | todo

Continuation of #43970

* Rebased, including bug fixes.
* Added description to completion values, implemented for commands and options names. (should be used for fish also)
```
% bin/console [TAB]
about                       -- Display information about the current project
assets:install              -- Install bundle's web assets under a public directory
cache:clear                 -- Clear the cache
cache:pool:clear            -- Clear cache pools
```

Commits
-------

3c2e1a4 Finish Zsh completion
405f207 Add zsh completion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Console Feature Help wanted Issues and PRs which are looking for volunteers to complete them. Keep open
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants