Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add quiet option to apidoc #375

Merged
merged 1 commit into from
May 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions breathe/apidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,21 @@
'group': 'Group'}


def print_info(msg, args):
if not args.quiet:
print(msg)


def write_file(name, text, args):
"""Write the output file for module/package <name>."""
fname = os.path.join(args.destdir, '%s.%s' % (name, args.suffix))
if args.dryrun:
print('Would create file %s.' % fname)
print_info('Would create file %s.' % fname, args)
return
if not args.force and os.path.isfile(fname):
print('File %s already exists, skipping.' % fname)
print_info('File %s already exists, skipping.' % fname, args)
else:
print('Creating file %s.' % fname)
print_info('Creating file %s.' % fname, args)
if not os.path.exists(os.path.dirname(fname)):
try:
os.makedirs(os.path.dirname(fname))
Expand All @@ -64,7 +69,7 @@ def write_file(name, text, args):
with open(fname, 'r') as target:
orig = target.read()
if orig == text:
print('File %s up to date, skipping.' % fname)
print_info('File %s up to date, skipping.' % fname, args)
return
except FileNotFoundError:
# Don't mind if it isn't there
Expand Down Expand Up @@ -162,6 +167,8 @@ def main():
help='project to add to generated directives')
parser.add_argument('-g', '--generate', action=TypeAction, dest='outtypes',
help='types of output to generate, comma-separated list')
parser.add_argument('-q', '--quiet', action='store_true', dest='quiet',
help='suppress informational messages')
parser.add_argument('--version', action='version',
version='Breathe (breathe-apidoc) %s' % __version__)
parser.add_argument('rootpath', type=str,
Expand Down