Callback for creating the "--ascii-doc" handler.

@param Args    $args    The console arguments.
@param IO      $io      The I/O.
@param Command $command The handled command.

@return HelpAsciiDocHandler The created handler.
544704
public function createAsciiDocHandler(Args $args, IO $io, Command $command)
    {
        $path = $this->getAsciiDocPage($command->getApplication(), $args);

        $handler = new HelpAsciiDocHandler($path, $this->executableFinder, $this->processLauncher);
        $handler->setLessBinary($this->lessBinary);

        return $handler;
    }
1319597
public function execute(Arguments $args, ConsoleIo $io)
    {
        $this->createFile($io, Folder::slashTerm(WWW_ROOT) . 'robots.txt', 'User-agent: *' . PHP_EOL .
            'Disallow: /admin/' . PHP_EOL . 'Disallow: /ckeditor/' . PHP_EOL .
            'Disallow: /css/' . PHP_EOL . 'Disallow: /js/' . PHP_EOL .
            'Disallow: /vendor/');

        return null;
    }
825689
public function handleList(Args $args, IO $io)
    {
        $moduleNames = ArgsUtil::getModuleNames($args, $this->modules);
        $bindingStates = $this->getBindingStates($args);

        $printBindingState = count($bindingStates) > 1;
        $printModuleName = count($moduleNames) > 1;
        $printHeaders = $printBindingState || $printModuleName;
        $printAdvice = true;
        $indentation = $printBindingState && $printModuleName ? 8
            : ($printBindingState || $printModuleName ? 4 : 0);

        foreach ($bindingStates as $bindingState) {
            $bindingStatePrinted = !$printBindingState;

            foreach ($moduleNames as $moduleName) {
                $expr = Expr::method('getContainingModule', Expr::method('getName', Expr::same($moduleName)))
                    ->andMethod('getState', Expr::same($bindingState));

                $descriptors = $this->discoveryManager->findBindingDescriptors($expr);

                if (empty($descriptors)) {
                    continue;
                }

                $printAdvice = false;

                if (!$bindingStatePrinted) {
                    $this->printBindingStateHeader($io, $bindingState);
                    $bindingStatePrinted = true;
                }

                if ($printModuleName) {
                    $prefix = $printBindingState ? '    ' : '';
                    $io->writeLine(sprintf('%sModule: %s', $prefix, $moduleName));
                    $io->writeLine('');
                }

                $this->printBindingTable($io, $descriptors, $indentation, BindingState::ENABLED === $bindingState);

                if ($printHeaders) {
                    $io->writeLine('');
                }
            }
        }

        if ($printAdvice) {
            $io->writeLine('No bindings found. Use "puli bind <artifact> <type>" to bind an artifact to a type.');
        }

        return 0;
    }
94285
static public IParserInput getInstance(
            final char commandPrefix,
            final File args)
                    throws IOException
    {
        return getInstance(commandPrefix, false, args);
    }
667043
public function execute(Arguments $args, ConsoleIo $io)
    {
        $path = $args->getOption('path') ?: Folder::slashTerm(ROOT) . 'composer.json';

        try {
            is_writable_or_fail($path);
        } catch (Exception $e) {
            $io->err($e->getMessage());
            $this->abort();
        }

        //Gets and decodes the file
        $contents = json_decode(file_get_contents($path), true);

        if (empty($contents)) {
            $io->err(__d('me_tools', 'The file {0} does not seem a valid {1} file', rtr($path), 'composer.json'));
            $this->abort();
        }

        //Checks if the file has been fixed
        if (empty($contents['config']['component-dir']) || $contents['config']['component-dir'] !== 'vendor/components') {
            $contents += ['config' => ['component-dir' => 'vendor/components']];
            create_file($path, json_encode($contents, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
            $io->verbose(__d('me_tools', 'The file {0} has been fixed', rtr($path)));
        } else {
            $io->verbose(__d('me_tools', 'The file {0} doesn\'t need to be fixed', rtr($path)));
        }

        return null;
    }
6802
public function execute(Arguments $args, ConsoleIo $io)
    {
        $command = new AddUserCommand;

        return $command->run(['--group', 1] + $args->getOptions(), $io);
    }
461246
def call_command_handler(command, pymux, arguments):
    
    assert isinstance(arguments, list)

    # Resolve aliases.
    command = ALIASES.get(command, command)

    try:
        handler = COMMANDS_TO_HANDLERS[command]
    except KeyError:
        pymux.show_message('Invalid command: %s' % (command,))
    else:
        try:
            handler(pymux, arguments)
        except CommandException as e:
            pymux.show_message(e.message)
300909
protected function executeSubCommand($name, IOInterface $io = null)
    {
        if (empty($this->children[$name])) {
            throw new CommandNotFoundException(sprintf('Command "%s" not found.', $name), $this, $name);
        }

        /** @var $subCommand AbstractCommand */
        $subCommand = $this->children[$name];

        // Remove first argument and send it to child
        if (!$io) {
            $io = $this->io;

            $io->shiftArgument();
        }

        $subCommand->setIO($io)
            ->setApplication($this->console);

        return $subCommand->execute();
    }
387170
public function execute(Arguments $args, ConsoleIo $io)
    {
        foreach ($this->config as $file) {
            list($plugin, $file) = pluginSplit($file);
            $this->copyFile(
                $io,
                Plugin::path($plugin, 'config' . DS . $file . '.php'),
                Folder::slashTerm(CONFIG) . $file . '.php'
            );
        }

        return null;
    }
555721
public function handle(Args $args, IO $io)
    {
        $path = Path::makeAbsolute($args->getArgument('path'), $this->currentPath);

        $resource = $this->repo->get($path);

        if (!$resource->hasChildren()) {
            throw new RuntimeException(sprintf(
                'The resource "%s" does not have children.',
                $resource->getPath()
            ));
        }

        if ($args->isOptionSet('long')) {
            $this->listLong($io, $resource->listChildren());

            return 0;
        }

        $this->listShort($io, $resource->listChildren());

        return 0;
    }
81303
function delegateCommand(command) {
        var xformedArgs = [],
            origArgs = Array.prototype.slice.call(arguments, 1),
            retVal;

        transformVariables(origArgs, xformedArgs);

        retVal = uploader()[command].apply(uploader(), xformedArgs);

        return maybeWrapInJquery(retVal);
    }
339054
public function command($command, $method) {

        self::$commands[] = $command;
        self::$callbacks[$command] = $method;
    }
223935
def format_as_command(str, io)
      if Cri::Platform.color?(io)
        green(str)
      else
        str
      end
    end
948799
public static void main(String[] args) throws IOException {
    if (args.length == 0 || args[0].equals("--help")) {
      help();
      return;
    }
    for (String a : args) {
      countFile(a);
    }
  }
211159
public function execute(Arguments $args, ConsoleIo $io) {
		$syncer = $this->getSyncer();
		$syncer->syncAcl($args, $io);
		$io->out('Controllers and ACL synced.');

		return static::CODE_SUCCESS;
	}
268987
public function execute($command, array $arguments = array(), $cwd = null)
    {
        $arguments += $this->getGlobalArguments();

        try {
            $result = $this->adapter->execute($command, $arguments, $cwd);
        } catch (\Exception $e) {
            // @todo move to a generic error handler? Something similar to the ParserInterface
            if (preg_match('/url \'[^\']+\' non-existent/i', $e->getMessage()) ||
                preg_match('/file not found/i', $e->getMessage()) ||
                preg_match('/path not found/i', $e->getMessage())
            ) {
                throw new NotFoundException($e->getMessage());
            }

            throw $e;
        }

        return $result;
    }
168062
public function getHandlerToRun(Args $args, IO $io, Command $command)
    {
        $rawArgs = $args->getRawArgs();

        // The raw arguments should always be available, but check anyway
        if (!$rawArgs) {
            return 'text';
        }

        // If "-h" is given, always print the short text usage
        if ($rawArgs->hasToken('-h')) {
            return 'text';
        }

        // Check if any of the options is set
        foreach ($this->getRegisteredNames() as $handlerName) {
            if ($rawArgs->hasToken('--'.$handlerName)) {
                return $handlerName;
            }
        }

        // No format option is set, "-h" is not set
        // If a command is given or if "--help" is set, display the manual
        if ($rawArgs->hasToken('--help')) {
            // Return "man" if the binary is available and the man page exists
            // The process launcher must be supported on the system
            $manPage = $this->getManPage($command->getApplication(), $args);

            if (file_exists($manPage) && $this->processLauncher->isSupported()) {
                if (!$this->manBinary) {
                    $this->manBinary = $this->executableFinder->find('man');
                }

                if ($this->manBinary) {
                    return 'man';
                }
            }

            // Return "ascii-doc" if the AsciiDoc page exists
            $asciiDocPage = $this->getAsciiDocPage($command->getApplication(), $args);

            if (file_exists($asciiDocPage)) {
                return 'ascii-doc';
            }
        }

        // No command, no option -> display command list as text
        return 'text';
    }