From 8af920c8924b2fd9a0e4192c3c7e6085b687bfdc Mon Sep 17 00:00:00 2001 From: Lukas Heffner Date: Thu, 7 Dec 2023 20:12:52 +0100 Subject: [PATCH] Add helptext to ansible-inventory's positional arg (#82332) * Add helptext to ansible-inventory's positional arg This explanation is already present in the documentation and should make the usage more clear when looking at the --help output * fix indentation * change description of positional arg It has no effect on --list and the docs now reflect that --- lib/ansible/cli/inventory.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ansible/cli/inventory.py b/lib/ansible/cli/inventory.py index cfb5e306bd3..c92b1300cb9 100755 --- a/lib/ansible/cli/inventory.py +++ b/lib/ansible/cli/inventory.py @@ -50,8 +50,7 @@ class InventoryCLI(CLI): name = 'ansible-inventory' - ARGUMENTS = {'host': 'The name of a host to match in the inventory, relevant when using --list', - 'group': 'The name of a group in the inventory, relevant when using --graph', } + ARGUMENTS = {'group': 'The name of a group in the inventory, relevant when using --graph', } def __init__(self, args): @@ -62,7 +61,7 @@ class InventoryCLI(CLI): def init_parser(self): super(InventoryCLI, self).init_parser( - usage='usage: %prog [options] [host|group]', + usage='usage: %prog [options] [group]', desc='Show Ansible inventory information, by default it uses the inventory script JSON format') opt_help.add_inventory_options(self.parser) @@ -73,7 +72,7 @@ class InventoryCLI(CLI): # remove unused default options self.parser.add_argument('--list-hosts', help=argparse.SUPPRESS, action=opt_help.UnrecognizedArgument) - self.parser.add_argument('args', metavar='host|group', nargs='?') + self.parser.add_argument('args', metavar='group', nargs='?', help='The name of a group in the inventory, relevant when using --graph') # Actions action_group = self.parser.add_argument_group("Actions", "One of following must be used on invocation, ONLY ONE!")