symfony2 console arguments
It is possible:
->addOption('arg', 'a', InputOption::VALUE_NONE)
- my:command =>
$input->getOption('arg') //false
- my:command --arg =>
$input->getOption('arg') //true
- my:command --arg=5 =>
$input->getOption('arg') //5
Answer by corvax is incorrect and doesn't work. As of today, you just cannot achieve this.
It is even stated in the Console documentation: Using Command Options.
See also these issues on GitHub:
Symfony2 have console component which can be used separately. You can see documentation here. For more example you can check implementations of SensioGeneratorBundle.