Using Console Commands, Shortcuts and Built-in Commands

In addition to the options you specify for your commands, there are some built-in options as well as a couple of built-in commands for Cleo.


These examples assume you have added a file to run at the cli:

#!/usr/bin/env python

from cleo import Application

application = Application()
# ...

if __name__ == '__main__':

Built-in Commands

The help command lists the help information for the specified command. For example, to get the help for the list command:

$ python help list

Running help without specifying a command will list the global options:

$ python help

Global Options

You can get help information for any command with the --help option. To get help for the greet command:

$ python greet --help
$ python greet -h

You can suppress output with:

$ python greet --quiet
$ python greet -q

You can get more verbose messages (if this is supported for a command) with:

$ python greet --verbose
$ python greet -v

If you need more verbose output, use -vv or -vvv

$ python greet -vv
$ python greet -vvv

If you set the optional arguments to give your application a name and version:

application = Application('console', '1.2')

then you can use:

$ python --version
$ python -V

to get this information output:

Console version 1.2

If you do not provide both arguments then it will just output:

console tool

You can force turning on ANSI output coloring with:

$ python greet --ansi

or turn it off with:

$ python greet --no-ansi

You can suppress any interactive questions from the command you are running with:

$ python greet --no-interaction
$ python greet -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:

$ python h