-$self = array_shift( $argv );
-$IP = realpath( dirname( $self ) . "/.." );
-chdir( $IP );
-
-$options = array();
-$args = array();
-
-for( $arg = reset( $argv ); $arg !== false; $arg = next( $argv ) ) {
- if ( substr( $arg, 0, 2 ) == '--' ) {
- # Long options
- $option = substr( $arg, 2 );
- if ( in_array( $option, $optionsWithArgs ) ) {
- $param = next( $argv );
- if ( $param === false ) {
- die( "$arg needs an value after it\n" );
- }
- $options[$option] = $param;
- } else {
- $bits = explode( '=', $option, 2 );
- if( count( $bits ) > 1 ) {
- $option = $bits[0];
- $param = $bits[1];
- } else {
- $param = 1;
- }
- $options[$option] = $param;
- }
- } elseif ( $arg{0} == '-' ) {
- # Short options
- for ( $p=1; $p<strlen( $arg ); $p++ ) {
- $option = $arg{$p};
- if ( in_array( $option, $optionsWithArgs ) ) {
- $param = next( $argv );
- if ( $param === false ) {
- die( "$arg needs an value after it\n" );
- }
- $options[$option] = $param;
- } else {
- $options[$option] = 1;
- }
+class CommandLineInc extends Maintenance {
+ public function __construct() {
+ global $optionsWithArgs;
+ parent::__construct();
+ foreach ( $optionsWithArgs as $name ) {
+ $this->addOption( $name, '', false, true );