Display help for this console.

@return ConsoleOptionParser
332841
public function getOptionParser()
    {
        $parser = new ConsoleOptionParser('console');
        $parser
            ->description("This shell clean the cache of your application.")
            ->command("cache.clear")
            ->addOption('all', [
                'short' => 'a',
                'help' => 'Clear all caches',
                'boolean' => true,
            ])

            ->addSubcommand('all', [
                'help' => 'Clear all caches',
            ])
            ;

        foreach ( $this->tasks as $task => $option ) {
            $classname = $this->taskClassname($task);

            $parser->addSubcommand($this->taskName($task), [
                'help' => $this->$classname->help(),
                'parser' => $this->$classname->getOptionParser(),
            ]);
        }

        return $parser;
    }
1083382
public function consoleAction()
	{
	    $request   = $this->getRequest();
	    $service   = $this->fetchService();
	    $operation = $this->fetchOperation();
	    $query     = $this->fetchConsoleQuery();
	    
	    if (!$request instanceof ConsoleRequest) {
	        throw new \RuntimeException('You can only use this action from a console!');
	    }
	    
	    // Check flags
	    $verbose = $request->getParam('verbose') || $request->getParam('v');
	    $silent = $request->getParam('silent') || $request->getParam('s');
	    
	    $params = Json::decode(
            $query,
            Json::TYPE_ARRAY
        );
	    
	    try {
	        $data = $this->exec($service, $operation, $params, Command::CONTEXT_CLI);
	        return $this->prepareConsoleResponse($data, null, $verbose, $silent);
	    } catch (\Exception $exception) {
	        error_log($exception->getMessage() . ' (' . $exception->getFile().':'.$exception->getLine().')');
	        
	        return $this->prepareConsoleResponse(null, $exception, $verbose, $silent);
	    }
	}
1154608
def get_help_option(self, ctx):
        """"""
        help_options = self.get_help_option_names(ctx)
        if not help_options or not self.add_help_option:
            return

        def show_help(ctx, param, value):
            if value and not ctx.resilient_parsing:
                echo(ctx.get_help(), color=ctx.color)
                ctx.exit()
        return Option(help_options, is_flag=True,
                      is_eager=True, expose_value=False,
                      callback=show_help,
                      help='Show this message and exit.')
30386
public function getHelp()
	{
		$help='Usage: '.$this->getCommandRunner()->getScriptName().' '.$this->getName();
		$options=$this->getOptionHelp();
		if(empty($options))
			return $help."\n";
		if(count($options)===1)
			return $help.' '.$options[0]."\n";
		$help.=" <action>\nActions:\n";
		foreach($options as $option)
			$help.='    '.$option."\n";
		return $help;
	}
970206
protected static function helpAction()
    {
        $class = new \ReflectionClass(static::getCurrentClass());
        $methods = $class->getMethods();
        $commands = array();
        $comments = array();
        $commandLen = 0;
        foreach ($methods as $method) {
            $methodName = (string) $method->getName();
            if (substr($methodName, -6, 6) == 'Action') {
                $command = substr($methodName, 0, strlen($methodName) - 6);
                $comment = preg_replace('#^[^a-zA-Z0-9_.()-]*(.*?)[^a-zA-Z0-9_.()-]*$#', '\1', $method->getDocComment());
                $commandLen = max(strlen($command), $commandLen);
                $commands[] = $command;
                $comments[] = $comment;
            }
        }
        $commandLen++;
        echo "\n  Usage: " . self::green() . basename($_SERVER['argv'][0]) . self::yellow() . ' <command>' . self::resetColor() . " [options]\n\n";
        foreach ($commands as $key => $command) {
            printf(self::yellow() . " %' " . $commandLen . 's' . self::resetColor() . ": %s\n", $command, $comments[$key]);
        }
        echo "\n";
    }
826257
public function getOptionParser()
    {
        $parser = parent::getOptionParser();
        $parser->addSubcommand('clear', [
            'help' => 'Clear all metadata caches for the connection. If a ' .
                'table name is provided, only that table will be removed.',
        ])->addSubcommand('build', [
            'help' => 'Build all metadata caches for the connection. If a ' .
            'table name is provided, only that table will be cached.',
        ])->addOption('connection', [
            'help' => 'The connection to build/clear metadata cache data for.',
            'short' => 'c',
            'default' => 'default',
        ])->addArgument('name', [
            'help' => 'A specific table you want to clear/refresh cached data for.',
            'optional' => true,
        ]);

        return $parser;
    }
1002442
public function getOptionParser() {
		$parser = parent::getOptionParser();
		$parser->addArgument('name(s)', array(
			'required' => true,
			'help' => 'Enter one or more cache/view names separated by comma or "all"' .
			"\n<comment>(choises: " . implode(',', array_merge(Cache::configured(), array('all'))) . ")</comment>"
		));
		$parser->addOption('views', array(
			'boolean' => true,
			'help' => 'If set views files will be deleted' .
			"\n<comment>(choises: " . implode(',', array('view_file_name*', 'all')) . ")</comment>"
		));
		return $parser->description('Clear cache');
	}
555945
final public function optionHelp()
    {
        // Show Usage
        output()->write(
            (new Format())
                ->setContextualClass(Format::INFO)
                ->setString(language()->getLine('CLI_USAGE') . ':')
                ->setNewLinesBefore(1)
                ->setNewLinesAfter(1)
        );

        // Show Actions
        $this->loadActions();

        if (count($this->actionsPool)) {
            output()->write(
                (new Format())
                    ->setContextualClass(Format::INFO)
                    ->setString($this->commandName . '/action --option=value')
            );

            output()->write(
                (new Format())
                    ->setString(language()->getLine('CLI_ACTIONS') . ':')
                    ->setNewLinesBefore(2)
                    ->setNewLinesAfter(1)
            );

            $table = new Table();
            $table->isShowBorder = false;

            foreach ($this->actionsPool as $action) {

                if ($action instanceof AbstractCommander) {
                    $table
                        ->addRow()
                        ->addColumn($action->getCommandName())
                        ->addColumn(language()->getLine($action->getCommandDescription()));
                }
            }

            output()->write(
                (new Format())
                    ->setString($table->render())
            );
        } else {
            output()->write(
                (new Format())
                    ->setContextualClass(Format::INFO)
                    ->setString($this->commandName . ' --option=value')
            );
        }

        // Show Options
        output()->write(
            (new Format())
                ->setString(language()->getLine('CLI_OPTIONS') . ':')
                ->setNewLinesBefore(2)
                ->setNewLinesAfter(1)
        );

        $table = new Table();
        $table->isShowBorder = false;

        foreach ($this->commandOptions as $optionCaller => $optionProps) {
            $table
                ->addRow()
                ->addColumn('--' . $optionCaller)
                ->addColumn($optionProps[ 'shortcut' ])
                ->addColumn(language()->getLine($optionProps[ 'description' ]));
        }

        output()->write(
            (new Format())
                ->setString($table->render())
                ->setNewLinesAfter(2)
        );

        exit(EXIT_SUCCESS);
    }
1034165
protected function help_formatter( $help = null ) 
	{
		if ( is_null( $help ) ) 
		{
			CCCli::line( 'Invalid data passed to help formatter.' , 'red' ); return;
		}
	
		$output = array();
		
		// print the name
		if ( isset( $help['name'] ) ) 
		{	
			$output[] = '+-'.str_repeat( '-', strlen( $help['name'] ) ).'-+';
			$output[] = '| '.CCCli::color( $help['name'], 'light_yellow' ).' |';
			$output[] = '+-'.str_repeat( '-', strlen( $help['name'] ) ).'-+';	
		}
		
		// description
		if ( isset( $help['desc'] ) ) 
		{
			$output[] = wordwrap( str_replace( "\n", "\n".' * ', $help['desc'] ), 60 );	
		}
		
		// list the actions 
		if ( isset( $help['actions'] ) && !empty( $help['actions'] ) ) 
		{	
			// for every action in this console controller
			foreach( $help['actions'] as $action => $attributes )
			{
				// print the action
				$output[] = '';
				$output[] = '| '.CCStr::suffix( get_called_class(), '\\' ).'::'.CCCli::color( $action, 'cyan' );
				$output[] = '|';
				
				// for every attribute ( arguments, usage etc. )
				foreach( $attributes as $attribute => $options )
				{
					$output[] = '| '.CCCli::color( ucfirst( $attribute ), 'light_yellow' );
					
					// if we just got a string
					if ( is_string( $options ) )
					{
						$output[] = '|  '.CCCli::color( $options, 'green' );
					}
					// a key value array
					elseif ( is_array( $options ) )
					{
						// print every option and its description
						foreach( $options as $option => $description )
						{
							$buffer = CCCli::color( $option, 'green' );
							$buffer .= str_repeat( ' ', 35 - strlen( $buffer ) );
							$buffer .= $description;
							$buffer = '|  '.$buffer;
							
							// is the line to long?
							if ( strlen( $buffer ) > 80 )
							{
								$overflow = substr( $buffer, 80 );
								
								$buffer = substr( $buffer, 0, 80 )."\n";
								
								$overflow = wordwrap( $overflow, 45 );
								$overflow = explode( "\n", $overflow );
								
								foreach( $overflow as $key => $value )
								{
									$overflow[$key] = '| '.str_repeat( ' ',  25 ).trim( $value );	
								}
								
								$buffer .= implode( "\n", $overflow );
							}
							
							$output[] = $buffer;
						}
					}
					
					$output[] = '|';
				}
				
				array_pop( $output );
			}
		}
		
		return $output;
	}
125019
protected static function showHelp()
    {
        \cli\line();
        \cli\out(self::$arguments->getHelpScreen(\cli\Colors::colorize('%N%n%gAvailable commands:')));
        \cli\line();
    }
412874
protected function _help() {
		$help = new Help([
			'request' => $this->request,
			'response' => $this->response,
			'classes' => $this->_classes
		]);
		return $help->run(get_class($this));
	}
593360
public function getOptionParser()
    {
        $parser = parent::getOptionParser();
        $parser
            ->description(__d('eav', 'Select target table'))
            ->addOption('use', [
                'short' => 'u',
                'help' => __d('eav', 'The table alias name. e.g. "User.Users".'),
            ])
            ->addOption('action', [
                'short' => 'a',
                'help' => __d('eav', 'Indicates what you want to do, drop an existing column or add a new one.'),
                'default' => 'add',
                'choices' => ['add', 'drop'],
            ])
            ->addOption('name', [
                'short' => 'n',
                'help' => __d('eav', 'Name of the column to be added or dropped'),
            ])
            ->addOption('type', [
                'short' => 't',
                'help' => __d('eav', 'Type of information for the column being added.'),
                'default' => 'string',
                'choices' => EavToolbox::$types,
            ])
            ->addOption('bundle', [
                'short' => 'b',
                'help' => __d('eav', 'Indicates the column belongs to a bundle name within the table.'),
                'default' => null,
            ])
            ->addOption('searchable', [
                'short' => 's',
                'help' => __d('eav', 'Whether the column being created can be used in SQL WHERE clauses.'),
                'boolean' => true,
                'default' => true,
            ])
            ->addOption('overwrite', [
                'short' => 'o',
                'help' => __d('eav', 'Overwrite column definition if already exists. An exception will be raised when overwrite is disabled and column already exists.'),
                'boolean' => true,
            ]);

        return $parser;
    }
749530
public function showHelp()
    {
        $writer = $this->io()->writer();
        $header = "{$this->name}, version {$this->version}";
        $footer = 'Run `<command> --help` for specific help';

        if ($this->logo) {
            $writer->write($this->logo, true);
        }

        $this->outputHelper()->showCommandsHelp($this->commands(), $header, $footer);

        return ($this->onExit)();
    }
421799
public function getOptionParser(): ConsoleOptionParser
    {
        $parser = parent::getOptionParser();

        $updateFromCatalogParser = parent::getOptionParser();
        $updateFromCatalogParser->addOption('domain', [
            'default' => 'default',
            'help' => 'The domain to use',
        ]);
        $updateFromCatalogParser->addOption('overwrite', [
            'default' => false,
            'help' => 'If set, there will be no interactive question whether to continue.',
            'boolean' => true,
        ]);
        $updateFromCatalogParser->addOption('strip-references', [
            'boolean' => true,
            'help' => 'Whether to remove file usage references from resulting po and mo files.',
        ]);

        return $parser
            ->setDescription([
                'CkTools Shell',
                '',
                'Utilities',
            ])
            ->addSubcommand('updateFromCatalog', [
                'help' => 'Updates the PO file from the given catalog',
                'parser' => $updateFromCatalogParser,
            ]);
    }
76486
public function help()
    {
        $tf = new TableFormatter($this->colors);
        $text = '';

        $hascommands = (count($this->setup) > 1);
        foreach ($this->setup as $command => $config) {
            $hasopts = (bool)$this->setup[$command]['opts'];
            $hasargs = (bool)$this->setup[$command]['args'];

            // usage or command syntax line
            if (!$command) {
                $text .= $this->colors->wrap('USAGE:', Colors::C_BROWN);
                $text .= "\n";
                $text .= '   ' . $this->bin;
                $mv = 2;
            } else {
                $text .= "\n";
                $text .= $this->colors->wrap('   ' . $command, Colors::C_PURPLE);
                $mv = 4;
            }

            if ($hasopts) {
                $text .= ' ' . $this->colors->wrap('<OPTIONS>', Colors::C_GREEN);
            }

            if (!$command && $hascommands) {
                $text .= ' ' . $this->colors->wrap('<COMMAND> ...', Colors::C_PURPLE);
            }

            foreach ($this->setup[$command]['args'] as $arg) {
                $out = $this->colors->wrap('<' . $arg['name'] . '>', Colors::C_CYAN);

                if (!$arg['required']) {
                    $out = '[' . $out . ']';
                }
                $text .= ' ' . $out;
            }
            $text .= "\n";

            // usage or command intro
            if ($this->setup[$command]['help']) {
                $text .= "\n";
                $text .= $tf->format(
                    array($mv, '*'),
                    array('', $this->setup[$command]['help'] . "\n")
                );
            }

            // option description
            if ($hasopts) {
                if (!$command) {
                    $text .= "\n";
                    $text .= $this->colors->wrap('OPTIONS:', Colors::C_BROWN);
                }
                $text .= "\n";
                foreach ($this->setup[$command]['opts'] as $long => $opt) {

                    $name = '';
                    if ($opt['short']) {
                        $name .= '-' . $opt['short'];
                        if ($opt['needsarg']) {
                            $name .= ' <' . $opt['needsarg'] . '>';
                        }
                        $name .= ', ';
                    }
                    $name .= "--$long";
                    if ($opt['needsarg']) {
                        $name .= ' <' . $opt['needsarg'] . '>';
                    }

                    $text .= $tf->format(
                        array($mv, '30%', '*'),
                        array('', $name, $opt['help']),
                        array('', 'green', '')
                    );
                    $text .= "\n";
                }
            }

            // argument description
            if ($hasargs) {
                if (!$command) {
                    $text .= "\n";
                    $text .= $this->colors->wrap('ARGUMENTS:', Colors::C_BROWN);
                }
                $text .= "\n";
                foreach ($this->setup[$command]['args'] as $arg) {
                    $name = '<' . $arg['name'] . '>';

                    $text .= $tf->format(
                        array($mv, '30%', '*'),
                        array('', $name, $arg['help']),
                        array('', 'cyan', '')
                    );
                }
            }

            // head line and intro for following command documentation
            if (!$command && $hascommands) {
                $text .= "\n";
                $text .= $this->colors->wrap('COMMANDS:', Colors::C_BROWN);
                $text .= "\n";
                $text .= $tf->format(
                    array($mv, '*'),
                    array('', 'This tool accepts a command as first parameter as outlined below:')
                );
                $text .= "\n";
            }
        }

        return $text;
    }
212257
public function helpAction()
    {
        $args = $this->getRequest()->getArgv();
        $command = !empty($args[2]) ? $args[2] : 'help';

        return $this->help($command);
    }
1002739
public function help()
    {
        $output = $this->getInfo().
        Colors::YELLOW."Description:".PHP_EOL.
        Colors::WHITE."  Displays version of the ironphp framework".PHP_EOL.
        PHP_EOL.
        Colors::YELLOW."Usage:".PHP_EOL.
        Colors::WHITE."  version".PHP_EOL.
        PHP_EOL.
        Colors::YELLOW."Arguments:".PHP_EOL.
        PHP_EOL.
        Colors::YELLOW."Options:".PHP_EOL.
        PHP_EOL.
        Colors::YELLOW."Help:".PHP_EOL.
        Colors::WHITE."  The ".Colors::GREEN."version".Colors::WHITE." display framework version:".PHP_EOL.
        PHP_EOL.
        Colors::GREEN."    php jarvis version".PHP_EOL.
        PHP_EOL.
        Colors::BG_BLACK.Colors::WHITE;
        return $output;
    }