You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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
We can use dirty solutions (read command arguments from $_SERVER['argv']):
Our CLI bootstrap file (bin/cli.php) reads arguments and passes them down the line until they reach FileLocker
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):
command using short option names (l): php bin/cli.php app:command foo --l=100
Lock file using method1: command-app-command-action-foo-limit-100.lock
Lock file using method2: command-app-command-foo-l-100.lock
command using long option names (limit): php bin/cli.php app:command foo --limit=100
Lock file using method1: command-app-command-action-foo-limit-100.lock
Lock file using method2: command-app-command-foo-limit-100.lock
Note:
As mentioned above, method2 requires changes in our CLI bootstrap file (bin/cli.php), so implementing the extended lock system in our projects would require updating dot-cli and the boostrap file.
see if we need to extend the lock file with actions or aditional paramethers
The text was updated successfully, but these errors were encountered: