Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Console] MentionArgvInput::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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
javiereguiluz merged 1 commit intosymfony:7.1fromalexandre-daubois:getraw-tokens
Apr 15, 2024

Conversation

alexandre-daubois
Copy link
Member

@alexandre-dauboisalexandre-daubois commentedMar 26, 2024
edited
Loading

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)]);

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 ofgetRawTokens()?

['-c', '-a', '--foo', '--bar=zzz', 'arg1', '--', 'arg2', '-b']

Also, what's the purpose of the boolean argument ofgetRawTokens()?

Thanks!

Copy link
MemberAuthor

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?

Copy link
Contributor

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 📱

alexandre-daubois and javiereguiluz reacted with thumbs up emoji

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!

@javiereguiluzjaviereguiluz merged commite38e45b intosymfony:7.1Apr 15, 2024
@javiereguiluz
Copy link
Member

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 (seea58dccf). I expanded the example a bit to show what exactly does the token array contain.

alexandre-daubois and lyrixx reacted with heart emoji

@alexandre-daubois
Copy link
MemberAuthor

Thanks for the rewording!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@OskarStarkOskarStarkOskarStark left review comments

Assignees
No one assigned
Projects
None yet
Milestone
7.1
Development

Successfully merging this pull request may close these issues.

[Console] Allow to return all tokens after the command name
4 participants
@alexandre-daubois@javiereguiluz@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp