Webmozart\Console\Config\DefaultApplicationConfig::configure PHP Method

configure() protected method

protected configure ( )
    protected function configure()
    {
        $this->setIOFactory(array($this, 'createIO'))->addEventListener(ConsoleEvents::PRE_RESOLVE, array($this, 'resolveHelpCommand'))->addEventListener(ConsoleEvents::PRE_HANDLE, array($this, 'printVersion'))->addOption('help', 'h', Option::NO_VALUE, 'Display help about the command')->addOption('quiet', 'q', Option::NO_VALUE, 'Do not output any message')->addOption('verbose', 'v', Option::OPTIONAL_VALUE, 'Increase the verbosity of messages: "-v" for normal output, "-vv" for more verbose output and "-vvv" for debug', null, 'level')->addOption('version', 'V', Option::NO_VALUE, 'Display this application version')->addOption('ansi', null, Option::NO_VALUE, 'Force ANSI output')->addOption('no-ansi', null, Option::NO_VALUE, 'Disable ANSI output')->addOption('no-interaction', 'n', Option::NO_VALUE, 'Do not ask any interactive question')->beginCommand('help')->markDefault()->setDescription('Display the manual of a command')->addArgument('command', Argument::OPTIONAL, 'The command name')->addOption('man', 'm', Option::NO_VALUE, 'Output the help as man page')->addOption('ascii-doc', null, Option::NO_VALUE, 'Output the help as AsciiDoc document')->addOption('text', 't', Option::NO_VALUE, 'Output the help as plain text')->addOption('xml', 'x', Option::NO_VALUE, 'Output the help as XML')->addOption('json', 'j', Option::NO_VALUE, 'Output the help as JSON')->setHandler(function () {
            return new HelpHandler();
        })->end();
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     $this->setEventDispatcher(new EventDispatcher());
     parent::configure();
     $this->setName('dancer')->setDisplayName('SkeletonDancer')->addOption('project-directory', null, Option::OPTIONAL_VALUE, 'The root directory of the project, this is where the ".dancer" directory is located. ' . 'When omitted the directory is automatically searched by the first occurrence of the ".dancer" directory
             in the parent directory structure, and falls back to the current working directory.')->addOption('config-file', null, Option::OPTIONAL_VALUE | Option::NULLABLE, 'Configuration file to load. When omitted the file `.dancer.yml` is automatically searched in the parent directory structure. Pass "null" to disable', '')->addOption('overwrite', null, Option::REQUIRED_VALUE, 'Default operation for existing files: abort, skip, force, ask, backup')->setVersion(self::VERSION)->setDebug('true' === getenv('SKELETON_DANCER_DEBUG'))->addStyle(Style::tag('good')->fgGreen())->addStyle(Style::tag('bad')->fgRed())->addStyle(Style::tag('warn')->fgYellow())->addStyle(Style::tag('hl')->fgGreen());
     $this->addEventListener(ConsoleEvents::PRE_HANDLE, function (PreHandleEvent $event) {
         // Set-up the IO for the Symfony Helper classes.
         if (!isset($this->container['console_io'])) {
             $io = $event->getIO();
             $args = $event->getArgs();
             $input = new ArgsInput($args->getRawArgs(), $args);
             $input->setInteractive($io->isInteractive());
             $this->container['console_io'] = $io;
             $this->container['console_args'] = $args;
             $this->container['sf.console_input'] = $input;
             $this->container['sf.console_output'] = new IOOutput($io);
         }
     });
     $this->addEventListener(ConsoleEvents::PRE_HANDLE, new ProjectDirectorySetupListener($this->container));
     $this->addEventListener(ConsoleEvents::PRE_HANDLE, new AutoLoadingSetupListener($this->container));
     $this->addEventListener(ConsoleEvents::PRE_HANDLE, new ExpressionFunctionsProviderSetupListener($this->container));
     $this->beginCommand('generate')->setDescription('Generates a new skeleton structure in the current directory')->addArgument('profile', Argument::OPTIONAL, 'The name of the profile')->addOption('all', null, Option::BOOLEAN, 'Ask all questions (including optional)')->addOption('dry-run', null, Option::BOOLEAN, 'Show what would have been executed, without actually executing')->setHandler(function () {
         return new Handler\GenerateCommandHandler($this->container['style'], $this->container['config'], $this->container['profile_config_resolver'], $this->container['answers_set_factory']);
     })->end()->beginCommand('profile')->setDescription('Manage the profiles of your project')->setHandler(function () {
         return new Handler\ProfileCommandHandler($this->container['style'], $this->container['profile_config_resolver'], $this->container['config']);
     })->beginSubCommand('list')->setHandlerMethod('handleList')->markDefault()->end()->beginSubCommand('show')->addArgument('name', Argument::OPTIONAL, 'The name of the profile')->setHandlerMethod('handleShow')->end()->end();
 }
All Usage Examples Of Webmozart\Console\Config\DefaultApplicationConfig::configure