Argument with -- alone specifies that the following arguments are not options
authorTim Starling <tstarling@users.mediawiki.org>
Sun, 16 Apr 2006 06:29:44 +0000 (06:29 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sun, 16 Apr 2006 06:29:44 +0000 (06:29 +0000)
maintenance/commandLine.inc

index b8188e6..416a887 100644 (file)
@@ -39,7 +39,15 @@ $args = array();
 # Parse arguments
 
 for( $arg = reset( $argv ); $arg !== false; $arg = next( $argv ) ) {
-       if ( substr( $arg, 0, 2 ) == '--' ) {
+       if ( $arg == '--' ) {
+               # End of options, remainder should be considered arguments
+               $arg = next( $argv );
+               while( $arg !== false ) {
+                       $args[] = $arg;
+                       $arg = next( $argv );
+               }
+               break;
+       } elseif ( substr( $arg, 0, 2 ) == '--' ) {
                # Long options
                $option = substr( $arg, 2 );
                if ( in_array( $option, $optionsWithArgs ) ) {