->register('echo') ->addArgument('foo', Console\Input\InputArgument::OPTIONAL, 'The directory') ->addOption('bar', null, Console\Input\InputOption::VALUE_REQUIRED) ->setCode(function(Console\Input\InputInterface $input, Console\Output\OutputInterface $output) { // output arguments and options }) ->getApplication() ->setDefaultCommand('echo', true) // Single command application ->run();