dotkernel / dot-cli

DotKernel component to build console applications based on laminas-cli.
https://docs.dotkernel.org/dot-cli/
MIT License
5 stars 2 forks source link

extend lock with actions #25

Open arhimede opened 10 months ago

arhimede commented 10 months ago

see if we need to extend the lock file with actions or aditional paramethers

alexmerlin commented 10 months ago

Command options/arguments are not yet readable where we inject our FileLocker mechanism, because Symfony parses them right before executing the command's execute method. Due to this, we're left with the following methods:

  1. We can force the parsing in dot-cli, but it comes with downsides:
    • we need to use an internal method (Symfony\Component\Console\Command::command())
    • the same method will be called again later by Symfony, so we're duplicating some code execution
  2. We can use dirty solutions (read command arguments from $_SERVER['argv']):
    1. Our CLI bootstrap file (bin/cli.php) reads arguments and passes them down the line until they reach FileLocker
    2. FileLocker reads the arguments itself from $_SERVER

One difference worth mentioning is that the second method is unable to identify arguments and options' short names. Examples (consider a command having an argument called action and an option called limit):

Note:

arhimede commented 10 months ago

@MarioRadu @roli85 @cPintiuta give your opinion about that please