Skip to content

[Console] Add new placeholder for application invoke method. #38349

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

Closed
wants to merge 3 commits into from

Conversation

rodrigoaguilera
Copy link

@rodrigoaguilera rodrigoaguilera commented Sep 29, 2020

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets no
License MIT
Doc PR -

I was a bit puzzled to find that the help for the list and help commands suggests that you call the console application by prefixing it with php myconsoleapp.
I am providing a script with a shebang like the first example from like is suggested in the following link:
https://symfony.com/doc/current/components/console.html
Eventually I want to distribute my console app as docker image so there is no need for php installed or the users even knowing is written in php.
The script name is easy to override by just setting a different value to $_SERVER['PHP_SELF'] but this php prefix is hardcoded into the help strings for the the two default commands available.

What I came up with is the concept of "invoke method" to refer to that php prefix and I added methods in the Application class to be able to remove it completely when is not needed. The default is set to the value that symfony 5.1 currently uses so is backwards compatible.

Slightly related to #38347 as I am trying to improve the console help output.
I didn't see any reference to the other placeholders in symfony/symfony-docs but I am willing to create docs for the three available if there interest in this feature.

What do you think?

@rodrigoaguilera rodrigoaguilera changed the title Add new placeholder for application invoke method. [Console] Add new placeholder for application invoke method. Sep 29, 2020
@ro0NL
Copy link
Contributor

ro0NL commented Sep 30, 2020

doesnt it belong to command.full_name actually 🤔

@rodrigoaguilera
Copy link
Author

rodrigoaguilera commented Sep 30, 2020

doesnt it belong to command.full_name actually

No, the php is hardcoded. See the following line:
https://github.com/symfony/symfony/blob/5.1/src/Symfony/Component/Console/Command/ListCommand.php#L44

@fabpot
Copy link
Member

fabpot commented Sep 30, 2020

What about removing php altogether instead of making this configurable (as it's not used everywhere anyway)?

@ro0NL
Copy link
Contributor

ro0NL commented Sep 30, 2020

@rodrigoaguilera i meant embedding the value in %command.full_name% rather than a new placeholder parameter. But i agree with @fabpot, not implying the invoked binary seems fine 👍

@rodrigoaguilera
Copy link
Author

Cool. That was one of the questions I forgot to ask: Why is that php there in the first place.

I'll open a new PR.

@xabbuh xabbuh added the Console label Sep 30, 2020
fabpot added a commit that referenced this pull request Oct 4, 2020
…odrigoaguilera)

This PR was merged into the 5.2-dev branch.

Discussion
----------

[Console] Remove "php" invokation from help messages.

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| License       | MIT

Discusstion started here:
#38349

I was a bit puzzled to find that the help for the list and help commands suggests that you call the console application by prefixing it with `php myconsoleapp`.

As suggested in the PR above I am removing the `php ` prefix from the help.

I am providing a script with a shebang like the first example suggested in the following link:
https://symfony.com/doc/current/components/console.html
Eventually I want to distribute my console app as docker image so there is no need for php installed or the users even knowing is written in php.
The script name is easy to override by just setting a different value to `$_SERVER['PHP_SELF']` but this php prefix is hardcoded into the help strings for the the two default commands available.

Slightly related to #38347 as I am trying to improve the console help output.

Commits
-------

e036c30 [Console] Remove "php" invokation from help messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants