contrib/geshi-cli.php
protected function createParser()
    {
        $geshi = new GeSHi();
        $parser = new Console_CommandLine();
        $parser->description = 'CLI interface to GeSHi, the generic syntax highlighter';
        $parser->version     = '0.1.0';

        $parser->addOption('css', array(
            'long_name'   => '--css',
            'description' => 'Use CSS classes',
            'action'      => 'StoreTrue',
            'default'     => false,
        ));
        $langs = $geshi->get_supported_languages();
        sort($langs);
        $parser->addOption('format', array(
            'short_name'  => '-f',
            'long_name'   => '--format',
            'description' => 'Format of file to highlight (e.g. php).',
            'help_name'   => 'FORMAT',
            'action'      => 'StoreString',
            'default'     => false,
            'choices'     => $langs,
        ));

        $parser->addArgument('infile', array('help_name' => 'source file'));

        return $parser;
    }
protected function createParser()
    {
        $geshi = new GeSHi();
        $parser = new Console_CommandLine();
        $parser->description = 'CLI interface to GeSHi, the generic syntax highlighter';
        $parser->version     = '0.1.0';

        $parser->addOption('css', array(
            'long_name'   => '--css',
            'description' => 'Use CSS classes',
            'action'      => 'StoreTrue',
            'default'     => false,
        ));
        $langs = $geshi->get_supported_languages();
        sort($langs);
        $parser->addOption('format', array(
            'short_name'  => '-f',
            'long_name'   => '--format',
            'description' => 'Format of file to highlight (e.g. php).',
            'help_name'   => 'FORMAT',
            'action'      => 'StoreString',
            'default'     => false,
            'choices'     => $langs,
        ));

        $parser->addArgument('infile', array('help_name' => 'source file'));

        return $parser;
    }
protected function createParser ( ) { $ geshi = new GeSHi ( ) ; $ parser = new Console_CommandLine ( ) ; $ parser -> description = 'CLI interface to GeSHi, the generic syntax highlighter' ; $ parser -> version = '0.1.0' ; $ parser -> addOption ( 'css' , array ( 'long_name' => '--css' , 'description' => 'Use CSS classes' , 'action' => 'StoreTrue' , 'default' => false , ) ) ; $ langs = $ geshi -> get_supported_languages ( ) ; sort ( $ langs ) ; $ parser -> addOption ( 'format' , array ( 'short_name' => '-f' , 'long_name' => '--format' , 'description' => 'Format of file to highlight (e.g. php).' , 'help_name' => 'FORMAT' , 'action' => 'StoreString' , 'default' => false , 'choices' => $ langs , ) ) ; $ parser -> addArgument ( 'infile' , array ( 'help_name' => 'source file' ) ) ; return $ parser ; }
Creates the command line parser and populates it with all allowed
options and parameters.

@return Console_CommandLine CommandLine object
Creates the command line parser and populates it with all allowed options and parameters .