TYPO3 Flow Base Distribution - Task #51183: CLI improvements
Command handling should support global flags
The current help handling in Flow is not intuitive. It would be much easier if every command would understand a "--help" switch that would trigger the help for that command. Also the main "flow" script should understand "--help" in addition to "help" like most known commands on the cli do.
#1 Updated by Bastian Waidelich about 7 years ago
Good point. Some more ideas for global flags (extract from irc):
some universal flags, like "-context", "-verbose" and so on. We could even add some special parsing so that these universal flags need to be before the command identifier: ./flow -v -c Production cache:warmup
#4 Updated by Christopher Hlubek about 7 years ago
Not exactly, Git also supports
git rebase --help. For long commands this is much more convenient than going back to the beginning and inserting
./flow --help produces an error, which is not very intuitive.
Karsten Dambekalns wrote:
Right now it follow the git model ;)
#5 Updated by Bastian Waidelich about 7 years ago
Christopher Hlubek wrote:
[...] this is much more convenient than going back to the beginning and inserting
+1 I think, this would be a nice feature!
For the other global flags ("verbose" & "context") I would expect it to work as follows:
if "--verbose" / "-v" is added
$this->isVerbose() returns TRUE.
If "--context" / "-c" is set, the command is transparently executed in that context (this probably has to be parsed before the subrequest is actually dispatched). Also it should probably be possible to specify multiple contexts and/or something like "all" (see #42520).
The question is: How can we tell those global flags from the command arguments? Should we make "verbose", "context" & "help" a protected keyword?
#6 Updated by Bastian Waidelich about 7 years ago
- Subject changed from Command handling should support --help to Command handling should support global flags
Bastian Waidelich wrote:
If "--context" / "-c" is set, the command is transparently executed in that context [...]
Currently it's not possible to determine all defined contexts (a context is implicitly created according to the FLOW_CONTEXT env variable).
An idea to circumvent this is, that a context is only valid if a corresponding directory exists in the global configuration folder, e.g.
This would allow us to fetch all registered (sub)contexts. Also it would make it easier to react to typos in the specified context.