-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Add completion values to input definition #44948
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
Conversation
8650876
to
dfb4cc6
Compare
I haven't looked at the code yet, but I really like the idea. See also these 2 comments on the original PR: #42251 Being able to predict whether an option has a value or not and maybe even dumping the static values to the completion file (e.g. for apps like Composer) are 2 other very interesting advantages of this approach. From https://github.com/posener/complete , mentioned in the comments I referenced above, I especially like the Predict enum:
Set: values are static, can be dumped (or described) We can even extend this with e.g. Files, to enable the great file completion system of shell completion. |
0f93398
to
f8e03db
Compare
After you comment @wouterj, I think we can use a union type that covers each cases.
We must stay open to file completion once we'd have managed to get it work #43607. |
src/Symfony/Component/Console/Command/DumpCompletionCommand.php
Outdated
Show resolved
Hide resolved
f8e03db
to
c4d65b3
Compare
c4d65b3
to
ab40533
Compare
e668ed4
to
0e31423
Compare
src/Symfony/Component/Console/Command/DumpCompletionCommand.php
Outdated
Show resolved
Hide resolved
d1a2af5
to
80654e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better :)
80654e5
to
5d70c9b
Compare
Thank you for all your time for this review. We have something very clear now. |
091027a
to
4f9c779
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. Just one minor question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some last minute nitpicking;
src/Symfony/Component/Console/Command/DumpCompletionCommand.php
Outdated
Show resolved
Hide resolved
ae8e882
to
a2a2e67
Compare
a2a2e67
to
95ad05f
Compare
What about this todo?
|
Could be part of an other PR. |
95ad05f
to
9951124
Compare
During implementation of bash completion to core commands, I found the code quite verbose. The completion for all options and arguments are mixed into the same method.
Example of current code
symfony/src/Symfony/Component/Console/Command/HelpCommand.php
Lines 85 to 98 in 098ff62
Command::complete
that uses this values.In the constructor of the
InputOption
andInputArgument
classes:symfony/src/Symfony/Component/Console/Command/HelpCommand.php
Lines 40 to 45 in 091027a
Or using
Command::addOption
andCommand::addArgument
:symfony/src/Symfony/Component/Console/Command/DumpCompletionCommand.php
Line 78 in 091027a
Additional benefits:
Todo: