Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend lock with actions #25

Open
arhimede opened this issue Dec 7, 2023 · 2 comments
Open

extend lock with actions #25

arhimede opened this issue Dec 7, 2023 · 2 comments
Assignees

Comments

@arhimede
Copy link
Member

arhimede commented Dec 7, 2023

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

@alexmerlin
Copy link
Member

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):

  • 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.

@arhimede arhimede pinned this issue Dec 11, 2023
@arhimede
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants