mwdocgen: support multiple --file values
authorAntoine Musso <hashar@free.fr>
Thu, 30 May 2013 18:41:27 +0000 (20:41 +0200)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 26 Jun 2013 13:00:15 +0000 (13:00 +0000)
It is sometimes useful to generate documentation for multiple files or
directories. Doxygen INPUT statement supports multiple space separated
paths. Example usage:

 php maintenance/mwdocgen.php --file docs,input

Change-Id: I66a805d80307c6502e9b440df63a37bb13093d84

maintenance/mwdocgen.php

index 1ca0b54..9fb1314 100644 (file)
@@ -57,7 +57,8 @@ class MWDocGen extends Maintenance {
                $this->addOption( 'generate-man',
                        'Whether to generate man files' );
                $this->addOption( 'file',
-                       'Only process given file (relative to $IP)',
+                       "Only process given file or directory. Multiple values " .
+                       "accepted with comma separation. Path relative to \$IP.",
                        false, true );
                $this->addOption( 'output',
                        'Path to write doc to',
@@ -75,7 +76,14 @@ class MWDocGen extends Maintenance {
 
                $this->doxygen = $this->getOption( 'doxygen', 'doxygen' );
                $this->mwVersion = $this->getOption( 'version', 'master' );
-               $this->input = $IP . '/' . $this->getOption( 'file', '' );
+
+               $this->input = '';
+               $inputs = explode( ',', $this->getOption( 'file', '' ) );
+               foreach( $inputs as $input ) {
+                       # Doxygen inputs are space separted and double quoted
+                       $this->input .= " \"$IP/$input\"";
+               }
+
                $this->output = $this->getOption( 'output', "$IP/docs" );
 
                $this->inputFilter = wfShellWikiCmd(