contrib/geshi-cli.php
public function run()
    {
        $parser = $this->createParser();
        try {
            $result = $parser->parse();
            $file   = $result->args['infile'];
            $format = $result->options['format'];
            $css    = $result->options['css'];

            if ($format == '') {
                $format = $this->detectFormat($file);
            }

            $geshi = new GeSHi(file_get_contents($file), $format);
            if ($css) {
                $geshi->enable_classes();
                echo '<style type="text/css">' . "\n"
                    . $geshi->get_stylesheet(true)
                    . "</style>\n";
            }
            echo $geshi->parse_code() . "\n";
        } catch (Exception $e) {
            $parser->displayError($e->getMessage());
            exit(1);
        }
    }
public function run()
    {
        $parser = $this->createParser();
        try {
            $result = $parser->parse();
            $file   = $result->args['infile'];
            $format = $result->options['format'];
            $css    = $result->options['css'];

            if ($format == '') {
                $format = $this->detectFormat($file);
            }

            $geshi = new GeSHi(file_get_contents($file), $format);
            if ($css) {
                $geshi->enable_classes();
                echo '<style type="text/css">' . "\n"
                    . $geshi->get_stylesheet(true)
                    . "</style>\n";
            }
            echo $geshi->parse_code() . "\n";
        } catch (Exception $e) {
            $parser->displayError($e->getMessage());
            exit(1);
        }
    }
public function run ( ) { $ parser = $ this -> createParser ( ) ; try { $ result = $ parser -> parse ( ) ; $ file = $ result -> args [ 'infile' ] ; $ format = $ result -> options [ 'format' ] ; $ css = $ result -> options [ 'css' ] ; if ( $ format == '' ) { $ format = $ this -> detectFormat ( $ file ) ; } $ geshi = new GeSHi ( file_get_contents ( $ file ) , $ format ) ; if ( $ css ) { $ geshi -> enable_classes ( ) ; echo '<style type="text/css">' . "\n" . $ geshi -> get_stylesheet ( true ) . "</style>\n" ; } echo $ geshi -> parse_code ( ) . "\n" ; } catch ( Exception $ e ) { $ parser -> displayError ( $ e -> getMessage ( ) ) ; exit ( 1 ) ; } }
Runs the script and outputs highlighted code.

@return void
Runs the script and outputs highlighted code .