-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Console] Mention ArgvInput::getRawTokens
#19713
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
Conversation
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
// pass the raw input of your command to the "ls" command | ||
$process = new Process(['ls', ...$input->getRawTokens(true)]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still have problems understanding what "a token" is in this context.
Imagine that I run a command like this:
$ php bin/console app:my-command -c -a --foo --bar=zzz arg1 -- arg2 -b
Is this the content of getRawTokens()
?
['-c', '-a', '--foo', '--bar=zzz', 'arg1', '--', 'arg2', '-b']
Also, what's the purpose of the boolean argument of getRawTokens()
?
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it is called a token because it can be anything: letters, pipes, dashes, etc. Not sure but that what makes the more sense to me 🙂
About the boolean argument, I wrote a sentence about it just under the code snippet. Should this also be present in the code snippet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will be back in 2 days, and I have an idea in mind. Will add a proposal then.
I am currently on a phone 📱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the end I merged this after rewording it a bit and expanding the code examples. If we don't like anything about this, let's create a new issue or PR. Thanks!
Alex, thanks for this contribution! I played with this option a bit locally to better understand it. That's why I reworded your contribution a bit while merging it (see a58dccf). I expanded the example a bit to show what exactly does the token array contain. |
Thanks for the rewording! |
Fix #19693, #19673