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.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)):
|
||||
print (self.color.code(n)
|
||||
+ node + ", " + str(baud) + " baud"
|
||||
+ self.color.reset)
|
||||
print "^C to exit"
|
||||
print "----------"
|
||||
output.write(self.color.code(n)
|
||||
+ node + ", " + str(baud) + " baud"
|
||||
+ self.color.reset + "\n")
|
||||
if not piped:
|
||||
output.write("^C to exit\n")
|
||||
output.write("----------\n")
|
||||
output.flush()
|
||||
|
||||
def start(self):
|
||||
self.alive = True
|
||||
|
@ -352,5 +354,5 @@ if __name__ == "__main__":
|
|||
raw = raw,
|
||||
color = (os.name == "posix" and not args.mono))
|
||||
if not quiet:
|
||||
term.print_header(nodes, bauds)
|
||||
term.print_header(nodes, bauds, sys.stderr, piped)
|
||||
term.run()
|
||||
|
|
Loading…
Reference in New Issue
Block a user