public function registerOption($long, $help, $short = null, $needsarg = false, $command = '')
    {
        if (!isset($this->setup[$command])) {
            throw new Exception("Command $command not registered");
        }

        $this->setup[$command]['opts'][$long] = array(
            'needsarg' => $needsarg,
            'help' => $help,
            'short' => $short
        );

        if ($short) {
            if (strlen($short) > 1) {
                throw new Exception("Short options should be exactly one ASCII character");
            }

            $this->setup[$command]['short'][$short] = $long;
        }
    }
public function registerOption($long, $help, $short = null, $needsarg = false, $command = '')
    {
        if (!isset($this->setup[$command])) {
            throw new Exception("Command $command not registered");
        }

        $this->setup[$command]['opts'][$long] = array(
            'needsarg' => $needsarg,
            'help' => $help,
            'short' => $short
        );

        if ($short) {
            if (strlen($short) > 1) {
                throw new Exception("Short options should be exactly one ASCII character");
            }

            $this->setup[$command]['short'][$short] = $long;
        }
    }
public function registerOption ( $ long , $ help , $ short = null , $ needsarg = false , $ command = '' ) { if ( ! isset ( $ this -> setup [ $ command ] ) ) { throw new Exception ( "Command $command not registered" ) ; } $ this -> setup [ $ command ] [ 'opts' ] [ $ long ] = array ( 'needsarg' => $ needsarg , 'help' => $ help , 'short' => $ short ) ; if ( $ short ) { if ( strlen ( $ short ) > 1 ) { throw new Exception ( "Short options should be exactly one ASCII character" ) ; } $ this -> setup [ $ command ] [ 'short' ] [ $ short ] = $ long ; } }
Register an option for option parsing and help generation

@param string $long multi character option (specified with --)
@param string $help help text for this option
@param string|null $short one character option (specified with -)
@param bool|string $needsarg does this option require an argument? give it a name here
@param string $command what command does this option apply to
@throws Exception
Register an option for option parsing and help generation