always show return codes (seems like a reasonable thing to do), make one line output slightly more

obvious
This commit is contained in:
Michael DeHaan 2012-02-28 01:46:02 -05:00
parent cc2d3e0f1a
commit 859c572de8

View file

@ -33,8 +33,6 @@ def main(args):
parser = base_ans_parser()
parser.usage = "ans-command [options] command-to-run"
parser.add_option('-c', '--return-codes', dest='return_codes', action='store_true',
help="prefix each line with the command's return code")
parser.add_option('-1', '--one-line', dest='one_line', action='store_true',
help="output results on one line to make grepping easier, however will \
not remove newlines from command output")
@ -95,14 +93,9 @@ def main(args):
continue
if options.one_line:
if options.return_codes:
print '%s:%s:%s:%s' % (hn, d['rc'], d['stdout'], d['stderr'])
print '%s | rc=%s | %s:%s' % (hn, d['rc'], d['stdout'], d['stderr'])
else:
print '%s:%s:%s' % (hn, d['stdout'], d['stderr'])
else:
print '%s:' % hn
if options.return_codes:
print 'return code:%s\n' % d['rc']
print "%s: => rc=%s" % (hn, d['rc'])
print '%s' % d['stdout']
if d.get('stderr', None):
print '%s' % d['stderr']