Phrozn/Runner/CommandLine/Callback/Base.php
protected function combine($file, $verbose = false)
    {

        $file = $this->getRealCommandName($file);
        $config = $this->getConfig();
        $file = $config['paths']['configs'] . 'commands/' . $file . '.yml';
        $data = Yaml::parse($file);

        if ($data === $file) {
            return false;
        }



        $docs = $data['docs'];
        $command = $data['command'];

        $out = '';
        $out .= sprintf("%s: %s\n", $docs['name'], $docs['summary']);
        $out .= 'usage: ' . trim($docs['usage']) . "\n";
        $out .= "\n  " . $this->pre($docs['description']) . "\n";

        $hasOptions = false;
        if (isset($command['options']) && count($command['options'])) {
            $out .= "Available options:\n";
            foreach ($command['options'] as $opt) {
                $spaces = str_repeat(' ', 30 - strlen($opt['doc_name']));
                $out .= "  {$opt['doc_name']} {$spaces} : {$opt['description']}\n";
            }
            $hasOptions = true;
        }
        if (isset($command['arguments']) && count($command['arguments'])) {
            $out .= $hasOptions ? "\n": "";
            $out .= "Valid arguments:\n";
            foreach ($command['arguments'] as $arg) {
                $spaces = str_repeat(' ', 30 - strlen($arg['help_name']));
                $out .= "  {$arg['help_name']} {$spaces} : {$arg['description']}\n";
            }
        }
        if (isset($command['commands']) && count($command['commands'])) {
            $out .= "Valid commands:\n";
            foreach ($command['commands'] as $subcommand) {
                $spaces = str_repeat(' ', 30 - strlen($subcommand['name']));
                $out .= "  {$subcommand['name']} {$spaces} : {$subcommand['description']}\n";
            }
        }

        if ($verbose) {
            if (isset($docs['extradesc'])) {
                $out .= "\nExtended Documentation:";
                $out .= "\n  " . $this->pre(trim($docs['extradesc'])) . "\n";
            }
            if (isset($docs['examples'])) {
                $out .= "\nExamples:";
                $out .= "\n  " . $this->pre(trim($docs['examples'])) . "\n";
            }
        } else {
            $out .= "\nUse help with -v or --verbose option to get more information.\n";
        }

        return $out;
    }
protected function combine($file, $verbose = false)
    {

        $file = $this->getRealCommandName($file);
        $config = $this->getConfig();
        $file = $config['paths']['configs'] . 'commands/' . $file . '.yml';
        $data = Yaml::parse($file);

        if ($data === $file) {
            return false;
        }



        $docs = $data['docs'];
        $command = $data['command'];

        $out = '';
        $out .= sprintf("%s: %s\n", $docs['name'], $docs['summary']);
        $out .= 'usage: ' . trim($docs['usage']) . "\n";
        $out .= "\n  " . $this->pre($docs['description']) . "\n";

        $hasOptions = false;
        if (isset($command['options']) && count($command['options'])) {
            $out .= "Available options:\n";
            foreach ($command['options'] as $opt) {
                $spaces = str_repeat(' ', 30 - strlen($opt['doc_name']));
                $out .= "  {$opt['doc_name']} {$spaces} : {$opt['description']}\n";
            }
            $hasOptions = true;
        }
        if (isset($command['arguments']) && count($command['arguments'])) {
            $out .= $hasOptions ? "\n": "";
            $out .= "Valid arguments:\n";
            foreach ($command['arguments'] as $arg) {
                $spaces = str_repeat(' ', 30 - strlen($arg['help_name']));
                $out .= "  {$arg['help_name']} {$spaces} : {$arg['description']}\n";
            }
        }
        if (isset($command['commands']) && count($command['commands'])) {
            $out .= "Valid commands:\n";
            foreach ($command['commands'] as $subcommand) {
                $spaces = str_repeat(' ', 30 - strlen($subcommand['name']));
                $out .= "  {$subcommand['name']} {$spaces} : {$subcommand['description']}\n";
            }
        }

        if ($verbose) {
            if (isset($docs['extradesc'])) {
                $out .= "\nExtended Documentation:";
                $out .= "\n  " . $this->pre(trim($docs['extradesc'])) . "\n";
            }
            if (isset($docs['examples'])) {
                $out .= "\nExamples:";
                $out .= "\n  " . $this->pre(trim($docs['examples'])) . "\n";
            }
        } else {
            $out .= "\nUse help with -v or --verbose option to get more information.\n";
        }

        return $out;
    }
protected function combine ( $ file , $ verbose = false ) { $ file = $ this -> getRealCommandName ( $ file ) ; $ config = $ this -> getConfig ( ) ; $ file = $ config [ 'paths' ] [ 'configs' ] . 'commands/' . $ file . '.yml' ; $ data = Yaml :: parse ( $ file ) ; if ( $ data === $ file ) { return false ; } $ docs = $ data [ 'docs' ] ; $ command = $ data [ 'command' ] ; $ out = '' ; $ out .= sprintf ( "%s: %s\n" , $ docs [ 'name' ] , $ docs [ 'summary' ] ) ; $ out .= 'usage: ' . trim ( $ docs [ 'usage' ] ) . "\n" ; $ out .= "\n  " . $ this -> pre ( $ docs [ 'description' ] ) . "\n" ; $ hasOptions = false ; if ( isset ( $ command [ 'options' ] ) && count ( $ command [ 'options' ] ) ) { $ out .= "Available options:\n" ; foreach ( $ command [ 'options' ] as $ opt ) { $ spaces = str_repeat ( ' ' , 30 - strlen ( $ opt [ 'doc_name' ] ) ) ; $ out .= "  {$opt['doc_name']} {$spaces} : {$opt['description']}\n" ; } $ hasOptions = true ; } if ( isset ( $ command [ 'arguments' ] ) && count ( $ command [ 'arguments' ] ) ) { $ out .= $ hasOptions ? "\n" : "" ; $ out .= "Valid arguments:\n" ; foreach ( $ command [ 'arguments' ] as $ arg ) { $ spaces = str_repeat ( ' ' , 30 - strlen ( $ arg [ 'help_name' ] ) ) ; $ out .= "  {$arg['help_name']} {$spaces} : {$arg['description']}\n" ; } } if ( isset ( $ command [ 'commands' ] ) && count ( $ command [ 'commands' ] ) ) { $ out .= "Valid commands:\n" ; foreach ( $ command [ 'commands' ] as $ subcommand ) { $ spaces = str_repeat ( ' ' , 30 - strlen ( $ subcommand [ 'name' ] ) ) ; $ out .= "  {$subcommand['name']} {$spaces} : {$subcommand['description']}\n" ; } } if ( $ verbose ) { if ( isset ( $ docs [ 'extradesc' ] ) ) { $ out .= "\nExtended Documentation:" ; $ out .= "\n  " . $ this -> pre ( trim ( $ docs [ 'extradesc' ] ) ) . "\n" ; } if ( isset ( $ docs [ 'examples' ] ) ) { $ out .= "\nExamples:" ; $ out .= "\n  " . $ this -> pre ( trim ( $ docs [ 'examples' ] ) ) . "\n" ; } } else { $ out .= "\nUse help with -v or --verbose option to get more information.\n" ; } return $ out ; }
Combine command documentation

@param string $file Command file to combine
@param boolean $verbose Whether to provide full documentation or just summary

@return string
Combine command documentation