Re: func's future and new maintainer!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On vr, 2012-08-03 at 13:25 -0400, Steve Salevan wrote:
>  Additionally, if you've ever come up with a patch in your dealings
> with Func, let me know, as we're hunting for some fellow
> committers/partners in crime.

Here's one that fixes something I find annoying. I'll paste it in the
mail this time. What's your preferred way of receiving patches?

-- 
Dennis K.

Life is what happens to you while you're busy making other plans 
  - John Lennon


>From 6457787b4d5a68b8208da530edc53ae218f19e71 Mon Sep 17 00:00:00 2001
From: Dennis Kaarsemaker <dennis.kaarsemaker@xxxxxxxxxxx>
Date: Sun, 8 Jul 2012 13:37:36 +0200
Subject: [PATCH] Always use full available screen width when pprinting a
 command result

---
 func/overlord/cmd_modules/call.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/func/overlord/cmd_modules/call.py b/func/overlord/cmd_modules/call.py
index 0847c84..85056c2 100644
--- a/func/overlord/cmd_modules/call.py
+++ b/func/overlord/cmd_modules/call.py
@@ -17,6 +17,10 @@ import optparse
 import pprint
 import xmlrpclib
 import sys
+import os
+import fcntl
+import termios
+import struct
 
 from func.overlord import client
 from func.overlord import base_command
@@ -254,7 +258,12 @@ class Call(base_command.BaseCommand):
             output = str(data)
             return output
 
-        return  pprint.pformat(data)
+        columns = 80
+        if 'COLUMNS' in os.environ:
+            columns = int(os.environ['COLUMNS'])
+        elif sys.stdin.isatty():
+            rows, columns = struct.unpack('hh', fcntl.ioctl(sys.stdin, termios.TIOCGWINSZ, '1234'))
+        return  pprint.pformat(data,width=columns)
 
     def do(self, args):
 
-- 
1.7.9.1


_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list


[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux