add --no-show-source option to report command
Add a ``--no-show-source`` option to the report command to skip including the note reference file names and SHA information in comments in the output. This restores the previous format of the output for cases where it is meant to be read by people directly, not just converted to HTML. Change-Id: Ie284b8a8e60d5a5f958d229c5972e8d9bf697d44 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
f6dbe94907
commit
33b135fe9a
@ -0,0 +1,8 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add a ``--no-show-source`` option to the report command to skip
|
||||
including the note reference file names and SHA information
|
||||
in comments in the output. This restores the previous format of
|
||||
the output for cases where it is meant to be read by people directly,
|
||||
not just converted to HTML.
|
@ -25,7 +25,8 @@ def _indent_for_list(text, prefix=' '):
|
||||
]) + '\n'
|
||||
|
||||
|
||||
def format_report(loader, config, versions_to_include, title=None):
|
||||
def format_report(loader, config, versions_to_include, title=None,
|
||||
show_source=True):
|
||||
report = []
|
||||
if title:
|
||||
report.append('=' * len(title))
|
||||
@ -49,7 +50,8 @@ def format_report(loader, config, versions_to_include, title=None):
|
||||
notefiles = loader[version]
|
||||
for n, sha in notefiles:
|
||||
if 'prelude' in file_contents[n]:
|
||||
report.append('.. %s @ %s\n' % (n, sha))
|
||||
if show_source:
|
||||
report.append('.. %s @ %s\n' % (n, sha))
|
||||
report.append(file_contents[n]['prelude'])
|
||||
report.append('')
|
||||
|
||||
@ -65,7 +67,8 @@ def format_report(loader, config, versions_to_include, title=None):
|
||||
report.append('-' * len(section_title))
|
||||
report.append('')
|
||||
for n, fn, sha in notes:
|
||||
report.append('.. %s @ %s\n' % (fn, sha))
|
||||
if show_source:
|
||||
report.append('.. %s @ %s\n' % (fn, sha))
|
||||
report.append('- %s' % _indent_for_list(n))
|
||||
report.append('')
|
||||
|
||||
|
@ -138,6 +138,13 @@ def main(argv=sys.argv[1:]):
|
||||
default=None,
|
||||
help='output filename, defaults to stdout',
|
||||
)
|
||||
do_report.add_argument(
|
||||
'--no-show-source',
|
||||
dest='show_source',
|
||||
default=True,
|
||||
action='store_false',
|
||||
help='do not show the source for notes',
|
||||
)
|
||||
_build_query_arg_group(do_report)
|
||||
do_report.set_defaults(func=report.report_cmd)
|
||||
|
||||
|
@ -28,6 +28,7 @@ def report_cmd(args, conf):
|
||||
conf,
|
||||
versions,
|
||||
title='Release Notes',
|
||||
show_source=args.show_source,
|
||||
)
|
||||
if args.output:
|
||||
with open(args.output, 'w') as f:
|
||||
|
Loading…
Reference in New Issue
Block a user