Skip to content

Commit

Permalink
apidoc: add -m, --members option flag
Browse files Browse the repository at this point in the history
Closes #691.
  • Loading branch information
vermeeren committed May 5, 2021
1 parent 42bc2af commit 0d1d755
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions breathe/apidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
'namespace': 'Namespace',
'group': 'Group'}

# Types that accept the :members: option.
MEMBERS_TYPES = [
'class',
'group',
'interface',
'namespace',
'struct'
]


def print_info(msg, args):
if not args.quiet:
Expand Down Expand Up @@ -85,11 +94,13 @@ def format_heading(level, text):
return '%s\n%s\n\n' % (text, underlining)


def format_directive(package_type, package, project):
def format_directive(package_type, package, args):
"""Create the breathe directive and add the options."""
directive = '.. doxygen%s:: %s\n' % (package_type, package)
if project:
directive += ' :project: %s\n' % project
if args.project:
directive += ' :project: %s\n' % args.project
if args.members and package_type in MEMBERS_TYPES:
directive += ' :members:\n'
return directive


Expand All @@ -99,7 +110,7 @@ def create_package_file(package, package_type, package_id, args):
if package_type not in args.outtypes:
return
text = format_heading(1, '%s %s' % (TYPEDICT[package_type], package))
text += format_directive(package_type, package, args.project)
text += format_directive(package_type, package, args)

write_file(os.path.join(package_type, package_id), text, args)

Expand Down Expand Up @@ -157,6 +168,8 @@ def main():
help='Directory to place all output', required=True)
parser.add_argument('-f', '--force', action='store_true', dest='force',
help='Overwrite existing files')
parser.add_argument('-m', '--members', action='store_true', dest='members',
help='Include members for types: %s' % MEMBERS_TYPES)
parser.add_argument('-n', '--dry-run', action='store_true', dest='dryrun',
help='Run the script without creating files')
parser.add_argument('-T', '--no-toc', action='store_true', dest='notoc',
Expand Down

0 comments on commit 0d1d755

Please sign in to comment.