]> git.itanic.dy.fi Git - emerge-timer/commitdiff
Beautify output
authorEsko Kokkonen <esko.kokkonen@gmail.com>
Sat, 24 Sep 2011 11:23:51 +0000 (14:23 +0300)
committerEsko Kokkonen <esko.kokkonen@gmail.com>
Sat, 24 Sep 2011 11:23:51 +0000 (14:23 +0300)
Have the '>>>' start on the same place on each row for easy emerge
time comparison.

emerge-timer.py

index 3c40b6e3844124e6bd4c025c744ab8b67e9fcb1f..1d376881cb58b750f43ea95c0058217f979c8cba 100755 (executable)
@@ -95,11 +95,17 @@ class package:
 
         if QUIET == False:
 
+            string_length = 0
+            for p in self.versions:
+                if len(p[0]) > string_length:
+                    string_length = len(p[0])
+
             for p in self.versions:
 
                 print('-'*90 + "\n" +
-                      green_start + self.name + p[0] + color_stop +
-                      "  >>>  " + give_time(p[1]) + "  >>>  " + give_date(p[2]))
+                      green_start + self.name + (p[0]).ljust(string_length) +
+                      color_stop + "  >>>  " + give_time(p[1]) + "  >>>  " +
+                      give_date(p[2]))
 
         print('-'*90 + "\n" + "Package " + green_start +
               self.name + color_stop + " emerged " +