Skip to content

Commit

Permalink
Applied some suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
dcsg committed Jan 5, 2014
1 parent 012456d commit c23f34e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions components/console/changing_default_behavior.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@ Changing the Default Behavior
=============================

When building a command line tool, you may need to customize it to fit your needs.
Probably you want to change the Default Command that the Application runs or
maybe you just want to run a Single Command instead of have to pass the command
name each time. Fortunately it is possible to do both.
Probably you want to change the default command that the Application runs or
maybe you just want to run a single command instead of have to pass the command
name each time. Fortunately, it is possible to do both.

Changing the Default Command
----------------------------

.. versionadded:: 2.5,
The :method:`Symfony\\Component\\Console\\Application::setDefaultCommand`
method was introduced in version 2.5
The :method:`Symfony\\Component\\Console\\Application::setDefaultCommand`
method was introduced in version 2.5.

By default the Application will always run the ListCommand. In order to change
the default command you just need to pass the command name you want to run by
default to the :method:`Symfony\\Component\\Console\\Application::setDefaultCommand`
method::
default to the ``setDefaultCommand`` method::

#!/usr/bin/env php
<?php
Expand Down Expand Up @@ -103,10 +102,10 @@ it is possible to remove this need by extending the application::
}
}

When calling your console script, the command ``MyCommand`` will then always
When calling your console script, the ``MyCommand`` command will then always
be used, without having to pass its name.

You can also simplify how you execute the application::
Executing the application can also be simplified::

#!/usr/bin/env php
<?php
Expand Down

0 comments on commit c23f34e

Please sign in to comment.