Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / symfony / console / Symfony / Component / Console / README.md
1 Console Component
2 =================
3
4 Console eases the creation of beautiful and testable command line interfaces.
5
6 The Application object manages the CLI application:
7
8     use Symfony\Component\Console\Application;
9
10     $console = new Application();
11     $console->run();
12
13 The ``run()`` method parses the arguments and options passed on the command
14 line and executes the right command.
15
16 Registering a new command can easily be done via the ``register()`` method,
17 which returns a ``Command`` instance:
18
19     use Symfony\Component\Console\Input\InputInterface;
20     use Symfony\Component\Console\Input\InputArgument;
21     use Symfony\Component\Console\Input\InputOption;
22     use Symfony\Component\Console\Output\OutputInterface;
23
24     $console
25         ->register('ls')
26         ->setDefinition(array(
27             new InputArgument('dir', InputArgument::REQUIRED, 'Directory name'),
28         ))
29         ->setDescription('Displays the files in the given directory')
30         ->setCode(function (InputInterface $input, OutputInterface $output) {
31             $dir = $input->getArgument('dir');
32
33             $output->writeln(sprintf('Dir listing for <info>%s</info>', $dir));
34         })
35     ;
36
37 You can also register new commands via classes.
38
39 The component provides a lot of features like output coloring, input and
40 output abstractions (so that you can easily unit-test your commands),
41 validation, automatic help messages, ...
42
43 Tests
44 ---------
45
46 You can run the unit tests with the following command:
47
48     phpunit
49
50 Resources
51 ---------
52
53 [The Console Component](http://symfony.com/doc/current/components/console.html)
54
55 [How to create a Console Command](http://symfony.com/doc/current/cookbook/console/console_command.html)