From 30cabddf76e740f136463628eb8684289a1d9a35 Mon Sep 17 00:00:00 2001 From: Stefhen Hovland Date: Fri, 14 Feb 2014 00:11:21 -0500 Subject: [PATCH 1/2] Ensure option output is sorted. --- bin/ansible-doc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ansible-doc b/bin/ansible-doc index 7e9a2eb81f5..96703d9bc1f 100755 --- a/bin/ansible-doc +++ b/bin/ansible-doc @@ -98,7 +98,7 @@ def get_man_text(doc): if 'option_keys' in doc and len(doc['option_keys']) > 0: text.append("Options (= is mandatory):\n") - for o in doc['option_keys']: + for o in sorted(doc['option_keys']): opt = doc['options'][o] if opt.get('required', False): @@ -146,7 +146,7 @@ def get_snippet_text(doc): text.append("- name: %s" % (desc)) text.append(" action: %s" % (doc['module'])) - for o in doc['options']: + for o in sorted(doc['options'].keys()): opt = doc['options'][o] desc = tty_ify("".join(opt['description'])) s = o + "=" From e1b7278265f11b8c77ceaf03a3dc5dee512c4325 Mon Sep 17 00:00:00 2001 From: Stefhen Hovland Date: Fri, 14 Feb 2014 00:12:29 -0500 Subject: [PATCH 2/2] Only display equals sign in summary for required options. --- bin/ansible-doc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/ansible-doc b/bin/ansible-doc index 96703d9bc1f..a77fff81302 100755 --- a/bin/ansible-doc +++ b/bin/ansible-doc @@ -149,7 +149,12 @@ def get_snippet_text(doc): for o in sorted(doc['options'].keys()): opt = doc['options'][o] desc = tty_ify("".join(opt['description'])) - s = o + "=" + + if opt.get('required', False): + s = o + "=" + else: + s = o + text.append(" %-20s # %s" % (s, desc)) text.append('')