Send header to stderr; omit instructions if piped
This commit is contained in:
parent
3839c00406
commit
b029c79e63
16
terminal.py
16
terminal.py
|
@ -123,13 +123,15 @@ class Jimterm:
|
||||||
self.add_cr = add_cr
|
self.add_cr = add_cr
|
||||||
self.raw = raw
|
self.raw = raw
|
||||||
|
|
||||||
def print_header(self, nodes, bauds):
|
def print_header(self, nodes, bauds, output = sys.stdout, piped = False):
|
||||||
for (n, (node, baud)) in enumerate(zip(nodes, bauds)):
|
for (n, (node, baud)) in enumerate(zip(nodes, bauds)):
|
||||||
print (self.color.code(n)
|
output.write(self.color.code(n)
|
||||||
+ node + ", " + str(baud) + " baud"
|
+ node + ", " + str(baud) + " baud"
|
||||||
+ self.color.reset)
|
+ self.color.reset + "\n")
|
||||||
print "^C to exit"
|
if not piped:
|
||||||
print "----------"
|
output.write("^C to exit\n")
|
||||||
|
output.write("----------\n")
|
||||||
|
output.flush()
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.alive = True
|
self.alive = True
|
||||||
|
@ -352,5 +354,5 @@ if __name__ == "__main__":
|
||||||
raw = raw,
|
raw = raw,
|
||||||
color = (os.name == "posix" and not args.mono))
|
color = (os.name == "posix" and not args.mono))
|
||||||
if not quiet:
|
if not quiet:
|
||||||
term.print_header(nodes, bauds)
|
term.print_header(nodes, bauds, sys.stderr, piped)
|
||||||
term.run()
|
term.run()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user