1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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