From 605097f3387928bbbe6206f981554858cc63d632 Mon Sep 17 00:00:00 2001 From: Richard Miller Date: Tue, 28 Aug 2012 23:50:27 +0100 Subject: [PATCH 1/3] Adding another page to the console section with info on general usage --- components/console/index.rst | 8 ++ .../{console.rst => console/introduction.rst} | 0 components/console/usage.rst | 136 ++++++++++++++++++ components/map.rst.inc | 5 +- redirection_map | 1 + 5 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 components/console/index.rst rename components/{console.rst => console/introduction.rst} (100%) create mode 100755 components/console/usage.rst diff --git a/components/console/index.rst b/components/console/index.rst new file mode 100644 index 00000000000..de84cb6051d --- /dev/null +++ b/components/console/index.rst @@ -0,0 +1,8 @@ +Config +====== + +.. toctree:: + :maxdepth: 2 + + introduction + usage diff --git a/components/console.rst b/components/console/introduction.rst similarity index 100% rename from components/console.rst rename to components/console/introduction.rst diff --git a/components/console/usage.rst b/components/console/usage.rst new file mode 100755 index 00000000000..2e2115e111c --- /dev/null +++ b/components/console/usage.rst @@ -0,0 +1,136 @@ +.. 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 + 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 + +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 + +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. diff --git a/components/map.rst.inc b/components/map.rst.inc index 491e1ec90c4..7ccad062f15 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -9,9 +9,10 @@ * :doc:`/components/config/caching` * :doc:`/components/config/definition` -* **The Console Component** +* :doc:`/components/console/index` - * :doc:`/components/console` + * :doc:`/components/console/introduction` + * :doc:`/components/console/usage` * **The CSS Selector Component** diff --git a/redirection_map b/redirection_map index 3e979ddb236..3fd1a16ea4a 100644 --- a/redirection_map +++ b/redirection_map @@ -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 From c6ad33de60bd98ceec75f1a971ed4653d86f9bcd Mon Sep 17 00:00:00 2001 From: Richard Miller Date: Tue, 28 Aug 2012 23:53:36 +0100 Subject: [PATCH 2/3] Adding info on running help without a specific command --- components/console/usage.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/console/usage.rst b/components/console/usage.rst index 2e2115e111c..5d367f1f8fa 100755 --- a/components/console/usage.rst +++ b/components/console/usage.rst @@ -44,6 +44,12 @@ example, to get the help for the ``list`` command: $ 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 ~~~~~~~~~~~~~~ From 641c9f00e3021485b06a7c2f4c51f12cc7ec9c93 Mon Sep 17 00:00:00 2001 From: Richard Miller Date: Wed, 29 Aug 2012 07:22:12 +0100 Subject: [PATCH 3/3] Fixing errors in console usage article --- components/console/usage.rst | 4 ++-- redirection_map | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/console/usage.rst b/components/console/usage.rst index 5d367f1f8fa..d05f70fa88f 100755 --- a/components/console/usage.rst +++ b/components/console/usage.rst @@ -103,13 +103,13 @@ You can force turning on ANSI output coloring with: .. code-block:: bash - $ php app/console list -ansi + $ php app/console list --ansi or turn it off with: .. code-block:: bash - $ php app/console list -no-ansi + $ php app/console list --no-ansi You can suppress any interactive questions from the command you are running with: diff --git a/redirection_map b/redirection_map index 3fd1a16ea4a..3ad6b27a7d3 100644 --- a/redirection_map +++ b/redirection_map @@ -15,4 +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 +/components/console /components/console/introduction