-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Added a cookbook entry about building single command applications #1810
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
This documents the way to achieve the use case requested in symfony/symfony#3857
@weaverryan I added it in the cookbook but I'm not sure about its location. Currently, all console cookbook entries are about the console in the full stack framework. This article is about the standalone component so it may be better to move it to the component documentation. what do you think about it ? |
@stof I think |
Hey Stof! I was waiting for someone to submit a PR like this, and of course it's you first :). This is the first entry that is really a "cookbook for the components" (since of course the normal cookbook is entirely for the framework). I agree with @wouterj that right now the best spot for this is in the components section. Fortunately, each component is still small enough that it should be pretty easy to find these other docs. I also think that when we have entries like this in the components docs, then we should have a "Learn More" section at the bottom of the main component's entry which lists these documents - similar to what we do already in the book. So, if you agre @stof, can you move it to be a component? Thanks as always! |
*/ | ||
protected function getCommandName(InputInterface $input) | ||
{ | ||
return 'my_command'; |
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.
We might need a small note here to make sure that it's clear that my_command
is the "name" used inside the MyCommand
below.
@weaverryan done. Btw, the Console component deserves many such articles, as it is really separate from others. And this is especially true now that people start documenting the console helpers, to avoid having the main page becoming too big. |
Added a cookbook entry about building single command applications
This introduces the idea of having short "intro" chapters for each component, followed by lots of related docs. This is a model that we largely want to follow in the components and in the framework book itself (we also need more in-context cross-linking between documents). I've also updated a few document titles to be more descriptive.
Hey Stof! I've added the "Learn More" section. This is our best model so far with how we should organize the component documentation (and really, certain chapters in the book should be shorter, with more inter-linking to cookbook articles). Once we figure out #1822, we definitely should refactor to have a dedicated section for each helper, and then add cross-links from other places in the docs - like the I'm telling you mostly so that we don't forget :) Thanks as always! |
Not sure if I did something wrong when trying to get this working but I needed to modify the initialize method of my command. protected function initialize(InputInterface $input, OutputInterface $output)
{
$input->setArgument('command', $this->getName());
} Without doing this I received errors because the input argument |
And what about changing the default command? |
This documents the way to achieve the use case requested in
symfony/symfony#3857