Review main Merged

83018[BUGFIX] Allow backend:user:create CLI Command to use shortcut options

Garvin Hicking CR +2 V +2 Easy +6 −1 updated 03/08/24, 18:28

Commit message

The Symfony CLI Command `backend:user:create` already offers shortcut
options like "-u XXX" instead of "--username=XXX" as an alternative.

This was broken, because the ENV/interactive fallback check only
performed a check on the full option name.

This check is now enhanced to also consider the shortcut.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Stefan Bürk +1
  • Verified V +2 Done
    • Benni Mack +2
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1215

  1. Garvin Hicking uploaded patch set 1 02/16/24, 16:18

  2. core-ci voted on patch set 1 V +1 02/16/24, 16:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53255

  3. Stefan Bürk commented on patch set 1 02/16/24, 16:41

    CreateBackendUserCommand.php:313

    Why not hand over the shurtcut explicitly with eventual nullable check for the futor / kind of best practice ? What I mean, add a $shortOption parameter and echeck that with single dash instead of doing `substr()` call - what do you think ? As this method is private, it should be doable. (usages needs to be adopted)
  4. Garvin Hicking commented on patch set 1 02/16/24, 16:44

    CreateBackendUserCommand.php:313 Reply

    Yeah, I thought that was too much effort for options that can be inferred... But I was caught on my laziness. Will go the non-sneaky route next week. :-)
  5. Garvin Hicking commented on patch set 1 02/16/24, 16:48

    CreateBackendUserCommand.php:313 Reply

    Hm, wait. I'd need to pass along the shortcut option then to each command, like: $this->getFallbackValueEnvOrOption($input, 'email', 'e', 'TYPO3_BE_USER_EMAIL'); and that would create redundancy because the shortcut command would not only be set in $this->configure() but also at other places, that might be prone to errors. Do you know if Symfony Commands offer a way to retrieve the shortcut from a given option? I couldn't find this with a quick search on the $input-> getters.
  6. Stefan Bürk commented on patch set 1 02/16/24, 16:58

    CreateBackendUserCommand.php:313 Reply

    $optionDefinition = $this->getDefinition()->getOption('option'); $optionName = $optionDefinition->getName() $optionShortcut = $optionDefinition-->getShortcut()
  7. Garvin Hicking uploaded patch set 2 V +1 02/16/24, 19:40

    Properly evaluate shortcut
  8. Garvin Hicking commented on patch set 2 02/16/24, 19:41

    CreateBackendUserCommand.php:313 Reply

    Done
  9. core-ci voted on patch set 2 V +1 02/16/24, 19:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53263

  10. Stefan Bürk commented on patch set 2 CR -1 03/04/24, 18:10

    CreateBackendUserCommand.php:310

    This does not respect the fact, that a option may not have a shortcut option set. If only a long-option is defined, `getShortcut()` returns `null`. Therefore the array like check below needs to be only enrichted with the shortcut option & the prefix if $optionShortcut is not null.
  11. Garvin Hicking uploaded patch set 3 CR -1 V +1 03/04/24, 19:05

  12. core-ci voted on patch set 3 V +1 03/04/24, 19:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53892

  13. Stefan Bürk commented on patch set 3 CR +1 V +1 03/04/24, 19:42

    CreateBackendUserCommand.php:310 Reply

    Done
  14. Benni Mack voted on patch set 3 CR +2 V +2 03/08/24, 18:27

  15. Benni Mack merged patch set 4 03/08/24, 18:28