Review main Merged

89659[FEATURE] Introduce shell auto-completion for the `typo3` script

Stefan Bürk CR +2 V +2 Normal +156 −1 updated 06/17/25, 16:18

Commit message

`symfony/console` supports registering autocompletion for the
symfony-cli and console applications for several shells for
some time:

* Symfony 5.4 for Bash
* Symfony 6.1 for Fish
* Symfony 6.2 for ZSH

These are some commonly used shell variants on today's systems.

This change registers the Symfony completion command to
make it available as part of the `typo3` script. It provides
help on how to register the autocompletion lists via:

> bin/typo3 completion --help

The default autocompletion behaviour is helpful and makes
using the CLI command easier, as it reduces the need
to manually complete commands, simply by using the `TAB`
key to cycle through completions/suggestions.

With this in place, it is possible to further improve TYPO3
commands, or commands provided by extension authors, by adding
a special completion handler for command options, like looking
up values or attributes/options in a database or a file
etc. (dynamic).

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 1722

  1. Stefan Bürk uploaded patch set 1 06/06/25, 09:06

  2. Stefan Bürk updated the commit message in patch set 2 06/06/25, 09:08

  3. core-ci voted on patch set 1 V -1 06/06/25, 09:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79977

  4. core-ci voted on patch set 2 V -1 06/06/25, 09:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79978

  5. Stefan Bürk uploaded patch set 3 V -1 06/06/25, 09:19

  6. core-ci voted on patch set 3 V +1 06/06/25, 09:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79979

  7. Garvin Hicking commented on patch set 4 V +1 06/07/25, 08:39

    Published edit on patch set 3.
  8. Garvin Hicking commented on patch set 4 CR +1 V +1 06/07/25, 08:44

    Works for me, however in ddev I have to manually specify that "bash" is my shell, even tough $SHELL="/bin/bash". But I think that's not issue of this patch. Nifty improvement, thanks for getting on it. I could probably even take this as a TASK and put it in v13 :-P
  9. core-ci voted on patch set 4 V +1 06/07/25, 08:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80047

  10. Stefan Bürk commented on patch set 4 06/08/25, 11:06

    Reply

    I would not break the policy here. This is clearly a "feature" - albeit a rough basic one. Tha power would be revealed once argument handling for commands are enrichched, kind of related how it has been done as a community effort for symfony itself: https://github.com/symfony/symfony/issues/43594 Beside that, once having it installied with a main/v14 into the shell it would at least tha generic tab for command compleation. Secondly, it's pretty easy to make a v12/v13 extension to register that command from the outside if wanted in projects for custom commands.
  11. Simon Schaufelberger commented on patch set 4 06/16/25, 12:09

    Feature-106839-IntroduceShellAuto-completionForTheTypo3Script.rst:83

    does this mean the arguments are only used from this one project and not for multiple different projects? I think the documentation should make it clear how to use the command for multiple projects being used on the same system.
  12. Stefan Bürk commented on patch set 4 06/17/25, 15:26

    Feature-106839-IntroduceShellAuto-completionForTheTypo3Script.rst:83 Reply

    I'd say that is enough for the changelog. If required can be done within the documentation in the general we document every command think. And it's also the default symfony command description.
  13. Garvin Hicking commented on patch set 4 06/17/25, 15:52

    Feature-106839-IntroduceShellAuto-completionForTheTypo3Script.rst:83 Reply

    I think, normally you would alter the shell inside the container with that auto completion, then it's project specific. Doing it on the host only works well if you have dedicated project workspaces or shells, but for people having this scenario they can deal on their own I would argue? Documenting shell scenarios might not need to be part of the TYPO3 changelog, since its not really our "feature"? I'd be in favor to get this in as-is, would that be fine with you?
  14. Simon Schaufelberger commented on patch set 4 06/17/25, 15:57

    Feature-106839-IntroduceShellAuto-completionForTheTypo3Script.rst:83 Reply

    I'm ok with it, I just wanted to clarify this because it specifically mentions "core" and having the line in "~/.bashrc" would be a global setting which can confuse people.
  15. Garvin Hicking commented on patch set 5 CR +1 V +1 06/17/25, 16:06

    Published edit on patch set 4.
  16. Garvin Hicking voted on patch set 5 CR +1 V +1 06/17/25, 16:06

  17. Garvin Hicking commented on patch set 5 06/17/25, 16:07

    Feature-106839-IntroduceShellAuto-completionForTheTypo3Script.rst:83 Reply

    I see your point. I added one sentence, is this an acceptable middleground for everyone? :-)
  18. Simon Schaufelberger commented on patch set 5 06/17/25, 16:09

    Feature-106839-IntroduceShellAuto-completionForTheTypo3Script.rst:83 Reply

    Acknowledged
  19. Simon Schaufelberger voted on patch set 5 CR +1 V +1 06/17/25, 16:09

  20. core-ci voted on patch set 5 V +1 06/17/25, 16:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80432

  21. Stefan Bürk voted on patch set 5 CR +2 V +2 06/17/25, 16:18

  22. Stefan Bürk merged patch set 6 06/17/25, 16:18