-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DX] Add completion to Symfony commands #43594
New issue
Hav 8000 e 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
Comments
I'm taking |
|
I'll take Should I wait for #43596 to be merged? Seems like that has a couple of useful things for testing. |
@andyexeter they are yours. |
I can try help uuid and config 🤔 |
Can I take following?
Also, is there a way to suggest directories or files? Using Finder for that seems a bit overkill. |
@StaffNowa File and directory autocompletion seems to be a native feature of |
@wouterj and I discussed files/folders being completed by falling back when nothing is suggested by Symfony. It will require a small tweak to the completion script generator. |
@GromNaN I'm asking because |
@IonBazan you should assume paths will get completed by The plan is to add a feature to the completion which will allow "signaling" from the completion output to the completion script, something like suggesting (just an example)
and the completion script running native filtering. I guess it's too late to add this now (feature freeze)? /cc @wouterj |
@dkarlovi It's not too late, but we would need to add support quickly if we want to have it in 5.4. |
@fabpot this described feature is sure nice, but take into account that the completion script should get tweaked that it falls back to the native completion anyway if Symfony doesn't suggest anything, as noted in #43594 (comment) That is a much smaller change so doable today. It will result in paths being completed as they usually would, so it goes:
(currently missing 2) With the signaling feature:
(1.1. is the new signaling feature) The "signaling" feature is absolutely a nice one, but IMO not a blocker. If somebody did it in time, it would be awesome, but it should get some design time since the use cases will need to be get worked out. The "fallback to filesystem when nothing suggested" thing is a blocker IMO, but luckily much simpler so can be done before 5.4. |
To keep things focused: please open a poc PR or issue if we need to discuss the file completion more in detail. Personally, given the late timing of this feature, I would propose to just rely on the default file autocompletion as a fallback. Then, in 6.1 (or later, whenever someone has time) we can introduce filtered file autocompletion by using signaling. Symfony <5.4 had zero auto completion, having a "working but not 100% feature complete" autocompletion in 5.4/6.0 is fine.
Yes, agreed. We don't have to filter, compgen is capable of that. |
I just realized falling back when Symfony suggests nothing doesn't work because Symfony might be right. For example, completing this:
to
is incorrect since Symfony was right to suggest nothing: in this context it's completing command names and there is no command matching this pattern, it would yield bad UX. So, seems signaling (however primitive) is the only correct way forward. Maybe we can suggest
when we want native completion. Later more semantics can be added. |
…NaN) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Console] Add completion to help & list commands | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | #43594 | License | MIT | Doc PR | no - Add completion for commands `help` and `list` - Create a tester class to wrap completion code in tests - To autocomplete option `--format`, supported formats are exposed by `DescriptorHelper` Commits ------- dc94c72 [Console] Add completion to help & list commands
Taking inspiration from https://github.com/posener/complete/tree/master , the only thing we might need to introduce in 5.4 is a
|
@GromNaN |
@GromNaN Great initiative! I can help to make auto-complete for |
@welcoMattic you are the one for |
Just a recap of the debugging info (as it's not yet documented): |
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- Add completion for debug:twig | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | #43594 | License | MIT | Doc PR | - Add completion for debug:twig Commits ------- 68c5e3c Add completion for debug:twig
Hey @makraz, do you have time or we can help you with server:log too? |
@GromNaN now I see server:log. Do we need to autocomplete hostname and format? According me it is not predictable |
What do you think of suggesting the default value for both? It would be useful as a starting point, instead of reading the doc. |
Yes good point👌 |
@GromNaN added default hosts and ports from real life :) |
…affNowa) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [FrameworkBundle] Add completion for workflow:dump | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | #43594 | License | MIT | Doc PR | - Add completion for workflow:dump We do not have tests here at all Commits ------- 5d3b60a [FrameworkBundle] Add completion for workflow:dump
…e (GromNaN) This PR was merged into the 5.4 branch. Discussion ---------- [Messenger] Add completion to command messenger:consume | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | #43594 | License | MIT | Doc PR | - Command `messenger:consume` takes a list of `receivers` that should be unique. The values for option `--bus` where easy to inject into the command. I skipped the option `--queue` whose values are defined deep in the transport options. Commits ------- f99f586 [Messenger] Add completion to command messenger:consume
This PR was merged into the 5.4 branch. Discussion ---------- [Framework] Add completion to debug:container | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | #43594 | License | MIT | Doc PR | - The command `debug:container` has several options which cannot be used all together. This PR adds completion for service names, tag names, parameter names and output format. Commits ------- 01fe89e [Framework] Add completion to debug:container
… (scyzoryck) This PR was merged into the 5.4 branch. Discussion ---------- [Messenger] Add command completion for failed messages | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | #43594 | License | MIT | Doc PR | no Add command completion for failed messages. Commits ------- a01a895 [Messenger] Add completion for failed messages commands.
…nt (eclairia, Adrien Jourdier) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- feat: add completion for DebugAutowiring search argument | Q | A | ------------- | --- | Branch? | 5.4 Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | #43594 | License | MIT | Doc PR | - Adding Bash completion debug:autowiring command. Commits ------- ef8c518 feat: add completion for DebugAutowiring search argument
Hi @stephenkhoo
Yes, you can add a test for the completion support. There is no direct need to add all missing tests (but if you want to do that as well, a PR is welcome to e.g. 4.4 or 5.3). |
Hi @StaffNowa sorry just back to online work |
@makraz Hey, it is not needed anymore for the server:log command. People decided do not nothing for this command :) |
…stephenkhoo) This PR was merged into the 5.4 branch. Discussion ---------- [Framework] Add completion to `debug:event-dispatcher` | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #43859 #43594 | License | MIT | Doc PR | - Rework PR from `@stephenkhoo` Commits ------- 97160dd Complete event name & dispatcher in EventDispatcherDebugCommand
…ll and push commands (welcoMattic) This PR was merged into the 5.4 branch. Discussion ---------- [Translation] Add completion feature on translation pull and push commands | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix (partially) symfony/symfony#43594 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | This PR adds completion for arguments and options on `translation:pull` and `translation:push` commands. Commits ------- 036b03278f Add completion feature on translation pull and push commands
Completion of command arguments and options is coming in Symfony 5.4 (#38275). Command and option names are already autocompleted, but argument and option values needs to be implemented on each command.
As an example, #42251 added completion to
secrets:remove
.This feature needs to be implemented on Symfony commands that has predictable values for their arguments and options.
Some guidelines:
compgen
(used by the shell script) does this for you based on the suggestions provided by PHPPLEASE, comment here BEFORE starting to work on something and WAIT for the confirmation to avoid duplicate work.
All commands have been claimed
debug:event-dispatcher
(event
,--dispatcher
,--format
) @stephenkhoo [Console] Add auto-completion to debug:event-dispatcher #43859debug:config
(name
,path
) @eclairia Add completion for DebugConfig name and path arguments #43850debug:autowiring
(search
) @eclairia feat: add completion for DebugAutowiring search argument #43838messenger:failed:remove
(id
,--transport
) @scyzoryck [Messenger] Add command completion for failed messages #43663messenger:failed:retry
(id
,--transport
) @scyzoryck [Messenger] Add command completion for failed messages #43663messenger:failed:show
(id
,--transport
) @scyzoryck [Messenger] Add command completion for failed messages #43663debug:container
(name
) @GromNaN [Framework] Add completion to debug:container #43857messenger:consume
(receivers
,--bus
,--queues
) @GromNaN [Messenger] Add completion to command messenger:consume #43891debug:firewall
(name
,--format
) @IonBazan [Console] add suggestions for debug commands: firewall, form, messenger, router #43598debug:form
(name
,--format
) @IonBazan [Console] add suggestions for debug commands: firewall, form, messenger, router #43598debug:messenger
(bus
) @IonBazan [Console] add suggestions for debug commands: firewall, form, messenger, router #43598debug:router
(name
) @IonBazan [Console] add suggestions for debug commands: firewall, form, messenger, router #43598cache:pool:clear
(pools
) @andyexeter Add completion for cache:pool:clear and cache:pool:delete commands #43621cache:pool:delete
(pool
,key
) @andyexeter Add completion for cache:pool:clear and cache:pool:delete commands #43621completion
(shell
) @dkarlovi [Console] feat: add completion for CompletionCommand "shell" argument #43615config:dump-reference
(name
,path
) @StaffNowa [FrameworkBundle] Add completion for config:dump-reference #43682help
(command_name
,--format
) @GromNaN [Console] Add completion to help & list commands #43596debug:translation
(locale
,bundle
,--domain
) @alexandre-daubois [FrameworkBundle] Add completion to debug:translation command #43644debug:twig
(name
,--filter
,--format
) @StaffNowa Add completion for debug:twig #43846list
(namespace
,--format
) @GromNaN [Console] Add completion to help & list commands #43596lint:twig
(filename
,--format
) @makraz Add suggestions for the option 'format' of lints commands: twig, yaml and xliff #43680lint:xliff
(filename
,--format
) @makraz Add suggestions for the option 'format' of lints commands: twig, yaml and xliff #43680lint:yaml
(filename
,--format
,--exclude
) @makraz Add suggestions for the option 'format' of lints commands: twig, yaml and xliff #43680messenger:setup-transports
(transport
) @Tayfun74 [Console] Add completion to messenger:setup-transports command #43640secrets:remove
(name
) @GromNaN [Console] [Framework] Add completion to secrets:set and fix secrets:remove #43626secrets:set
(name
,file
) @GromNaN [Console] [Framework] Add completion to secrets:set and fix secrets:remove #43626security:encode-password
(user-class
) @94noni [PasswordHasher] Add autocompletion for security commands #43653security:hash-password
(user-class
) @94noni [PasswordHasher] Add autocompletion for security commands #43653server:dump
(--format
) @alexandre-daubois [VarDumper] Add completion to server:dump command #43683translation:pull
(provider
,--domains
,--locales
,--format
) @welcoMattic [Translation] Add completion feature on translation pull and push commands #43672translation:push
(provider
,--domains
,--locales
) @welcoMattic [Translation] Add completion feature on translation pull and push commands #43672translation:update
(locale
,bundle
,--format
,--domain
,--sort
) @stephenkhoo [FrameworkBundle] Add completion feature on translation:update command #43676ulid:generate
(--format
) @StaffNowa [Uid] Allow use autocompletion #43639uuid:generate
(--format
) @StaffNowa [Uid] Allow use autocompletion #43639workflow:dump
(name
,marking
,--label
,--format
) @StaffNowa StaffNowa [FrameworkBundle] Add completion for workflow:dump #43848Commands that does not require auto-completion:
about
assets:install
(target
) (directory completion)cache:clear
cache:pool:list
cache:pool:prune
cache:warmup
debug:dotenv
dotenv:dump
debug:validator
(class
) @Kocal completion support not yet possiblelint:container
messenger:stop-workers
router:match
(path_info
)secrets:decrypt-to-local
secrets:encrypt-from-local
secrets:generate-keys
secrets:list
server:log
(--host
,--format
) @StaffNowa [MonologBridge] Add completion for server:log #43892ulid:inspect
uuid:inspect
The text was updated successfully, but these errors were encountered: