FEATURE: Introduce --help flag option for existing CLI commands
Upgrade instructions
None
Review instructions
This change introduces a new way of using the help function for existing Flow/Neos CLI commands.
Currently you always used:
./flow help user:create
With this change it is possible to use the new --help flag as an alternative at the end of a CLI command:
./flow user:create --help
But of course the first way will also still work!
Demo
https://github.com/neos/flow-development-collection/assets/39345336/4f93f5cf-0435-4344-b37a-0a76b6df7824
Checklist
- [x] Code follows the PSR-2 coding style
- [ ] Tests have been created, run and adjusted as needed
- [ ] The PR is created against the lowest maintained branch
- [ ] Reviewer - PR Title is brief but complete and starts with
FEATURE|TASK|BUGFIX - [ ] Reviewer - The first section explains the change briefly for change-logs
- [ ] Reviewer - Breaking Changes are marked with
!!!and have upgrade-instructions
Open TODOs
I'm still thinking about if i could implement this better.
Also i still have to think about how to improve the description for the --help flag. Because it is not even with the other options. It looks different because the description for the --help attribute is implemented in the HelpCommandController. And not like the others directly in the method signature.
And also the tests needs to be adjusted.
As it is not possible to combine --help with other options, I would remove the description.
but wonder if we shouldn't safeguard users who actually used help as argument in their command because that would be pretty breaking for them.
Good point! i havent thought about this so far.. How could we best do this?
but wonder if we shouldn't safeguard users who actually used help as argument in their command because that would be pretty breaking for them.
@kitsunet Do you maybe have an idea, how we could solve this the best way?
I think @kitsunet is right and we can't provide safely this global flag without potentially breaking dedicated help arguments of the commands.
Thanks for this contribution. This is a feature that I'm missing forever. It's small, but it really enhances UX.
If you're concerned about existing commands with a --help argument we could target 9.0.
But maybe we can easily detect these cases and ignore the global flag for those?
Lastly, I agree to @mhsdesign's comments about the check against --help – but personally I would be OK with that if the choice is hacky but working or not at all :)
Thanks for this contribution. This is a feature that I'm missing forever. It's small, but it really enhances UX.
If you're concerned about existing commands with a
--helpargument we could target9.0. But maybe we can easily detect these cases and ignore the global flag for those?Lastly, I agree to @mhsdesign's comments about the check against
--help– but personally I would be OK with that if the choice is hacky but working or not at all :)
But maybe we can easily detect these cases and ignore the global flag for those?
Yes, that would be awesome. As i think this is really a good improvement.
I wonder if there's actually any Flow application out there which implemented its own --help argument. And even if there is, I think it would be totally fine if this new feature would just override the custom implementation and that's it. It shouldn't cause an error, but I personally would be totally fine, if the custom argument implementation would just be ignored.
In that sense, what's missing to get this into 8.4? I'd love to have it in soon, so we can making plans for a release.
Yeah sorry i didnt meant to side track it with asking what happens if --help is a real argument.
In the end this will make
--helpan reserved argument and we have to agree on that (which is likely but still breaking? so!!!?)
But by that i was just trying to make a point that some things are not thought out yet ^^
i would put this logic at below line 155 of
$commandIdentifierso we can use this variable and also use$rawCommandLineArgumentsmeaning we support the$commandLinebeing a string possibly.Also the case
flow --helpwill with this implementation result in an error as there is no command id named--help. The general help should be shown i suppose....
Also this raw lookup against
--helpseems a little hacky. Like flow does support this short notation of boolean parameters but--help=trueor--help=falseare technically possible and will now still end up being passed to the final controller do we want that?
And the other points are still valid imo and have not been tackled.
It now adds the following at the bottom of the general help screen (list of commands):
And the command-specific help looks like this:
Let's merge this?
Thanks u both! @mhsdesign @robertlemke ❤️ Sorry i havent continue working on that 😅