]> granicus.if.org Git - php/commitdiff
- Align output of info command
authorMarcus Boerger <helly@php.net>
Tue, 15 May 2007 15:41:03 +0000 (15:41 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 15 May 2007 15:41:03 +0000 (15:41 +0000)
ext/phar/phar/pharcommand.inc

index a1a4bbe56977038a1af3c646b5e1457f8202b85e..02c012768a357b6525da91856374ee74c89d940f 100755 (executable)
@@ -591,15 +591,16 @@ class PharCommand extends CLICommand
                $phar  = $this->args['f']['val'];
 
                $hash  = $phar->getsignature();
+               $infos = array();
 
                if (!$hash)
                {
-                       echo "Hash: NONE\n";
+                       $infos['Hash'] = 'NONE';
                }
                else
                {
-                       echo "Hash Type: ${hash['hash_type']}\n";
-                       echo "Hash: ${hash['hash']}\n";
+                       $infos['Hash Type'] = $hash['hash_type'];
+                       $infos['Hash'] = $hash['hash'];
                }
 
                $csize   = 0;
@@ -626,10 +627,20 @@ class PharCommand extends CLICommand
                        }
                }
 
-               echo "Entries: $count\n";
-               echo "Compressed: $ccount\n";
-               echo "Uncompressed: $ucount\n";
-               echo "Metadata: $mcount\n";
+               $infos['Entries'] = $count;
+               $infos['Compressed'] = $ccount;
+               $infos['Uncompressed'] = $ucount;
+               $infos['Metadata'] = $mcount;
+
+               $l = 0;
+               foreach($infos as $which => $val)
+               {
+                       $l = max(strlen($which), $l);
+               }
+               foreach($infos as $which => $val)
+               {
+                       echo $which . ':' . str_repeat(' ', $l + 1 - strlen($which)) . $val . "\n";
+               }
        }
 }