]> arthur.barton.de Git - bup.git/commitdiff
main: when printing help, don't mix stdout/stderr.
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 21 Mar 2010 04:57:23 +0000 (00:57 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Sun, 21 Mar 2010 05:50:22 +0000 (01:50 -0400)
main.py

diff --git a/main.py b/main.py
index 2a5cbae2f969d6c53e8c86ba4be59a94caf9f1bf..6cbf0dcd91cc78fc03900d09c6e697227b168aa9 100755 (executable)
--- a/main.py
+++ b/main.py
@@ -28,8 +28,10 @@ def columnate(l, prefix):
     rows = len(l)/ncols
     for s in range(0, len(l), rows):
         cols.append(l[s:s+rows])
+    out = ''
     for row in zip(*cols):
-        print prefix + ''.join(('%-*s' % (clen+2, s)) for s in row)
+        out += prefix + ''.join(('%-*s' % (clen+2, s)) for s in row) + '\n'
+    return out
 
 
 def usage():
@@ -49,7 +51,7 @@ def usage():
 
     log('Common commands:\n')
     for cmd,synopsis in sorted(common.items()):
-        print '    %-10s %s' % (cmd, synopsis)
+        log('    %-10s %s\n' % (cmd, synopsis))
     log('\n')
     
     log('Other available commands:\n')
@@ -59,7 +61,7 @@ def usage():
             cname = c[4:]
             if cname not in common:
                 cmds.append(c[4:])
-    columnate(cmds, '    ')
+    log(columnate(cmds, '    '))
     log('\n')
     
     log("See 'bup help <command>' for more information on " +