From 52a55a35750cfa37d5922e5b820660a469e7ac3d Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Fri, 14 Dec 2012 11:12:26 +0100 Subject: [PATCH] cleanup Example output in ansible-doc --- bin/ansible-doc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/ansible-doc b/bin/ansible-doc index c892242357..7648e44178 100755 --- a/bin/ansible-doc +++ b/bin/ansible-doc @@ -89,8 +89,10 @@ def print_man(doc): subsequent_indent=opt_indent) - for ex in doc['examples']: - print "%s%s" % (opt_indent, ex['code']) + if 'examples' in doc and len(doc['examples']) > 0: + print "Example%s:\n" % ('' if len(doc['examples']) < 2 else 's') + for ex in doc['examples']: + print "%s\n" % (ex['code']) def print_snippet(doc):