src/Cli.php
protected function writeSchemaHelp($schema) {
        // Write the command description.
        $meta = Cli::val(Cli::META, $schema, []);
        $description = Cli::val('description', $meta);

        if ($description) {
            echo implode("\n", Cli::breakLines($description, 80, false)).PHP_EOL.PHP_EOL;
        }

        unset($schema[Cli::META]);

        // Add the help.
        $schema['help'] = [
            'description' => 'Display this help.',
            'type' => 'boolean',
            'short' => '?'
        ];

        echo Cli::bold('OPTIONS').PHP_EOL;

        ksort($schema);

        $table = new Table();
        $table->setFormatOutput($this->formatOutput);

        foreach ($schema as $key => $definition) {
            $table->row();

            // Write the keys.
            $keys = "--{$key}";
            if ($shortKey = Cli::val('short', $definition, false)) {
                $keys .= ", -$shortKey";
            }
            if (Cli::val('required', $definition)) {
                $table->bold($keys);
            } else {
                $table->cell($keys);
            }

            // Write the description.
            $table->cell(Cli::val('description', $definition, ''));
        }

        $table->write();
        echo PHP_EOL;

        $args = Cli::val(Cli::ARGS, $meta, []);
        if (!empty($args)) {
            echo Cli::bold('ARGUMENTS').PHP_EOL;

            $table = new Table();
            $table->setFormatOutput($this->formatOutput);

            foreach ($args as $argName => $arg) {
                $table->row();

                if (Cli::val('required', $arg)) {
                    $table->bold($argName);
                } else {
                    $table->cell($argName);
                }

                $table->cell(Cli::val('description', $arg, ''));
            }
            $table->write();
            echo PHP_EOL;
        }
    }
protected function writeSchemaHelp($schema) {
        // Write the command description.
        $meta = Cli::val(Cli::META, $schema, []);
        $description = Cli::val('description', $meta);

        if ($description) {
            echo implode("\n", Cli::breakLines($description, 80, false)).PHP_EOL.PHP_EOL;
        }

        unset($schema[Cli::META]);

        // Add the help.
        $schema['help'] = [
            'description' => 'Display this help.',
            'type' => 'boolean',
            'short' => '?'
        ];

        echo Cli::bold('OPTIONS').PHP_EOL;

        ksort($schema);

        $table = new Table();
        $table->setFormatOutput($this->formatOutput);

        foreach ($schema as $key => $definition) {
            $table->row();

            // Write the keys.
            $keys = "--{$key}";
            if ($shortKey = Cli::val('short', $definition, false)) {
                $keys .= ", -$shortKey";
            }
            if (Cli::val('required', $definition)) {
                $table->bold($keys);
            } else {
                $table->cell($keys);
            }

            // Write the description.
            $table->cell(Cli::val('description', $definition, ''));
        }

        $table->write();
        echo PHP_EOL;

        $args = Cli::val(Cli::ARGS, $meta, []);
        if (!empty($args)) {
            echo Cli::bold('ARGUMENTS').PHP_EOL;

            $table = new Table();
            $table->setFormatOutput($this->formatOutput);

            foreach ($args as $argName => $arg) {
                $table->row();

                if (Cli::val('required', $arg)) {
                    $table->bold($argName);
                } else {
                    $table->cell($argName);
                }

                $table->cell(Cli::val('description', $arg, ''));
            }
            $table->write();
            echo PHP_EOL;
        }
    }
protected function writeSchemaHelp ( $ schema ) { // Write the command description. $ meta = Cli :: val ( Cli :: META , $ schema , [ ] ) ; $ description = Cli :: val ( 'description' , $ meta ) ; if ( $ description ) { echo implode ( "\n" , Cli :: breakLines ( $ description , 80 , false ) ) . PHP_EOL . PHP_EOL ; } unset ( $ schema [ Cli :: META ] ) ; // Add the help. $ schema [ 'help' ] = [ 'description' => 'Display this help.' , 'type' => 'boolean' , 'short' => '?' ] ; echo Cli :: bold ( 'OPTIONS' ) . PHP_EOL ; ksort ( $ schema ) ; $ table = new Table ( ) ; $ table -> setFormatOutput ( $ this -> formatOutput ) ; foreach ( $ schema as $ key => $ definition ) { $ table -> row ( ) ; // Write the keys. $ keys = "--{$key}" ; if ( $ shortKey = Cli :: val ( 'short' , $ definition , false ) ) { $ keys .= ", -$shortKey" ; } if ( Cli :: val ( 'required' , $ definition ) ) { $ table -> bold ( $ keys ) ; } else { $ table -> cell ( $ keys ) ; } // Write the description. $ table -> cell ( Cli :: val ( 'description' , $ definition , '' ) ) ; } $ table -> write ( ) ; echo PHP_EOL ; $ args = Cli :: val ( Cli :: ARGS , $ meta , [ ] ) ; if ( ! empty ( $ args ) ) { echo Cli :: bold ( 'ARGUMENTS' ) . PHP_EOL ; $ table = new Table ( ) ; $ table -> setFormatOutput ( $ this -> formatOutput ) ; foreach ( $ args as $ argName => $ arg ) { $ table -> row ( ) ; if ( Cli :: val ( 'required' , $ arg ) ) { $ table -> bold ( $ argName ) ; } else { $ table -> cell ( $ argName ) ; } $ table -> cell ( Cli :: val ( 'description' , $ arg , '' ) ) ; } $ table -> write ( ) ; echo PHP_EOL ; } }
Writes the help for a given schema.

@param array $schema A command line scheme returned from {@see Cli::getSchema()}.
Writes the help for a given schema .