Irit Katriel <[email protected]> added the comment:
According to the docs it should be
>>> xgrp = parser.add_argument_group()
rather than
>>> xgrp = grp.add_argument_group()
This seems to work:
>>> parser = argparse.ArgumentParser()
>>> grp = parser.add_argument_group('Database settings')
>>> grp.add_argument('--db-config')
_StoreAction(option_strings=['--db-config'], dest='db_config', nargs=None,
const=None, default=None, type=None, choices=None, help=None, metavar=None)
>>> xgrp = parser.add_argument_group()
>>> xgrp.add_argument('--db-password')
_StoreAction(option_strings=['--db-password'], dest='db_password', nargs=None,
const=None, default=None, type=None, choices=None, help=None, metavar=None)
>>> parser.parse_args(['-h'])
usage: [-h] [--db-config DB_CONFIG] [--db-password DB_PASSWORD]
options:
-h, --help show this help message and exit
Database settings:
--db-config DB_CONFIG
--db-password DB_PASSWORD
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46057>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com