From af558698a09db36a292b236827e979a2aa661403 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Thu, 3 Aug 2017 13:38:08 -0400 Subject: [PATCH] Include aliases in ansible-doc output (#27702) * Properly include aliases in ansible-doc output Use correct variable name for storing aliases and only print them out if the list isn't empty. Fixes #24498 * Only include choices in output if choices exist in the list --- lib/ansible/cli/doc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py index 7f9ba3f2f63..dab8677d149 100644 --- a/lib/ansible/cli/doc.py +++ b/lib/ansible/cli/doc.py @@ -312,11 +312,13 @@ class DocCLI(CLI): aliases = '' if 'aliases' in opt: - choices = "(Aliases: " + ", ".join(str(i) for i in opt['aliases']) + ")" + if len(opt['aliases']) > 0: + aliases = "(Aliases: " + ", ".join(str(i) for i in opt['aliases']) + ")" del opt['aliases'] choices = '' if 'choices' in opt: - choices = "(Choices: " + ", ".join(str(i) for i in opt['choices']) + ")" + if len(opt['choices']) > 0: + choices = "(Choices: " + ", ".join(str(i) for i in opt['choices']) + ")" del opt['choices'] default = '' if 'default' in opt or not required: