justify help memcached console help
[lhc/web/wiklou.git] / maintenance / mcc.php
index 7598179..92f6863 100644 (file)
@@ -31,8 +31,12 @@ function mccShowHelp( $command ) {
                $command = 'fullhelp';
        }
        if ( $command === 'fullhelp' ) {
+               $max_cmd_len = 0;
+               foreach( array_keys( $commandList ) as $cmd ) {
+                       $max_cmd_len = max( $max_cmd_len, strlen($cmd) );
+               }
                foreach ( $commandList as $cmd => $desc ) {
-                       print "$cmd: $desc\n";
+                       printf( "%-{$max_cmd_len}s: %s\n", $cmd, $desc );
                }
        } elseif ( isset( $commandList[$command] ) ) {
                print "$command: $commandList[$command]\n";
@@ -46,7 +50,7 @@ do {
        $showhelp = false;
        $quit = false;
 
-       $line = readconsole( '> ' );
+       $line = Maintenance::readconsole();
        if ( $line === false ) exit;
 
        $args = explode( ' ', $line );