Task #42452

Task #51183: CLI improvements

Command handling should support global flags

Added by Christopher Hlubek almost 3 years ago. Updated 5 months ago.

Status:Closed Start date:2012-10-28
Priority:Should have Due date:
Assigned To:Bastian Waidelich % Done:

0%

Category:Cli
Target version:-
Sprint: Has patch:No
PHP Version: Complexity:

Description

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.


Related issues

related to TYPO3.Flow - Task #35709: Implement global Command aliases New 2012-04-05
related to TYPO3.Flow - Bug #42520: Cache must be flushed globally for package state changes New 2012-10-30
duplicated by TYPO3.Flow - Feature #37188: Global verbosity flags for CLI Commands Closed 2012-05-15
duplicated by TYPO3 Flow Base Distribution - Task #51187: Add generic help switch for all commands Closed 2013-08-19

History

#1 Updated by Bastian Waidelich almost 3 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

#2 Updated by Karsten Dambekalns almost 3 years ago

Right now it follow the git model ;)

#3 Updated by Karsten Dambekalns almost 3 years ago

  • Category set to Cli

#4 Updated by Christopher Hlubek almost 3 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 help. Also ./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 almost 3 years ago

Christopher Hlubek wrote:

[...] this is much more convenient than going back to the beginning and inserting help [...]

+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 over 2 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. Configuration/Development/MyContext
This would allow us to fetch all registered (sub)contexts. Also it would make it easier to react to typos in the specified context.

#7 Updated by Bastian Waidelich almost 2 years ago

  • Parent task set to #51183

#8 Updated by Bastian Waidelich 5 months ago

  • Status changed from New to Closed
  • Assigned To set to Bastian Waidelich

Also available in: Atom PDF