-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Adding another page to the console section with info on general usage #1664
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
Merged
weaverryan
merged 3 commits into
symfony:2.0
from
richardmiller-zz:adding_console_usage_docs
Sep 9, 2012
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Config | ||
====== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
introduction | ||
usage |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
.. index:: | ||
single: Console; Usage | ||
|
||
Console Usage | ||
============= | ||
|
||
As well as the options you specify for the commands you add there are some | ||
built options as well as a couple of built in commands for the console component. | ||
|
||
.. note:: | ||
These examples assume you have added a file ``app/console`` to run at | ||
the cli:: | ||
|
||
#!/usr/bin/env php | ||
# app/console | ||
<?php | ||
|
||
use Symfony\Component\Console\Application; | ||
|
||
$application = new Application(); | ||
// ... | ||
$application->run(); | ||
|
||
Built in Commands | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
There is a built in command ``list`` which outputs all the standard options | ||
and the registered commands: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console list | ||
|
||
You can get the same output by not running any command as well | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console | ||
|
||
The help command lists the help information for the specified command. For | ||
example, to get the help for the ``list`` command: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console help list | ||
|
||
Running ``help`` without specifying a command will list the global options: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console help | ||
|
||
Global Options | ||
~~~~~~~~~~~~~~ | ||
|
||
You can get help information for any command with the ``--help`` option, to | ||
get help for the list command: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console list --help | ||
$ php app/console list -h | ||
|
||
You can suppress output with: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console list --quiet | ||
$ php app/console list -q | ||
|
||
You can get more verbose messages (where this is supported for a command) | ||
with: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console list -verbose | ||
$ php app/console list -v | ||
|
||
If you set the optional arguments to give your application a name and version:: | ||
|
||
$application = new Application('Acme Console Application', '1.2'); | ||
|
||
then you can use: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console list -version | ||
$ php app/console list -V | ||
|
||
to get this information output: | ||
|
||
.. code-block:: text | ||
|
||
Acme Console Application version 1.2 | ||
|
||
If you do not provide both arguments then it will just output: | ||
|
||
.. code-block:: text | ||
|
||
console tool | ||
|
||
You can force turning on ANSI output coloring with: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console list -ansi | ||
|
||
or turn it off with: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console list -no-ansi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sale here: |
||
|
||
You can suppress any interactive questions from the command you are running with: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console list --no-interaction | ||
$ php app/console list -n | ||
|
||
Shortcut Syntax | ||
~~~~~~~~~~~~~~~ | ||
|
||
You do not have to type out the full command names. You can just type the | ||
shortest unambiguous name to run a command. So if there are non clashing | ||
commands, then you can run ``help`` like this: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console h | ||
|
||
If you have commands using ``:`` to namespace commands then you just have | ||
to type the shortest unambiguous text for each part. If you have created the | ||
``demo:greet`` as shown in :doc:`/components/console/introduction` then you | ||
can run it with: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console d:g Fabien | ||
|
||
If you choose too short a command so it is ambiguous then no command will be run and | ||
some suggestions of the possible commands to choose from will be output. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ | |
/components/dependency_injection /components/dependency_injection/introduction | ||
/components/event_dispatcher /components/event_dispatcher/introduction | ||
/components/http_foundation /components/http_foundation/introduction | ||
/components/dependency_injection /components/console/introduction | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this looks wrong |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
it is
--ansi