Skip to content

argument groups duplicate arguments #49

Closed
@croth1

Description

@croth1

This parser

def create_parser2():
    parser = argparse.ArgumentParser('foo')
    parser.add_argument('--foo', help='foo help')
    grp1 = parser.add_argument_group('bar options')
    grp1.add_argument('--bar', help='bar help')
    grp2 = parser.add_argument_group('bla options')
    grp2.add_argument('--bla', help='bla help')
    return parser

gives this command line help:


optional arguments:
  -h, --help  show this help message and exit
  --foo FOO   foo help

bar options:
  --bar BAR   bar help

bla options:
  --bla BLA   bla help

but renders to following sphinx output:

.. argparse::
  :module: foo
  :func: create_parser2
  :prog: foo
  :nodefaultconst:

   usage: foo [-h] [--foo FOO] [--bar BAR] [--bla BLA]

optional arguments
   --foo

   foo help

bar options
   --foo

   foo help

   --bar

   bar help

bla options
   --foo

   foo help

   --bar

   bar help

   --bla

   bla help

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions