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
pull/82383/head
Lukas Heffner 5 months ago committed by GitHub
parent 9b002d2e63
commit 8af920c892
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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!")

Loading…
Cancel
Save