Merge "add --no-show-source option to report command"
This commit is contained in:
@@ -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'
|
]) + '\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 = []
|
report = []
|
||||||
if title:
|
if title:
|
||||||
report.append('=' * len(title))
|
report.append('=' * len(title))
|
||||||
@@ -49,6 +50,7 @@ def format_report(loader, config, versions_to_include, title=None):
|
|||||||
notefiles = loader[version]
|
notefiles = loader[version]
|
||||||
for n, sha in notefiles:
|
for n, sha in notefiles:
|
||||||
if 'prelude' in file_contents[n]:
|
if 'prelude' in file_contents[n]:
|
||||||
|
if show_source:
|
||||||
report.append('.. %s @ %s\n' % (n, sha))
|
report.append('.. %s @ %s\n' % (n, sha))
|
||||||
report.append(file_contents[n]['prelude'])
|
report.append(file_contents[n]['prelude'])
|
||||||
report.append('')
|
report.append('')
|
||||||
@@ -65,6 +67,7 @@ def format_report(loader, config, versions_to_include, title=None):
|
|||||||
report.append('-' * len(section_title))
|
report.append('-' * len(section_title))
|
||||||
report.append('')
|
report.append('')
|
||||||
for n, fn, sha in notes:
|
for n, fn, sha in notes:
|
||||||
|
if show_source:
|
||||||
report.append('.. %s @ %s\n' % (fn, sha))
|
report.append('.. %s @ %s\n' % (fn, sha))
|
||||||
report.append('- %s' % _indent_for_list(n))
|
report.append('- %s' % _indent_for_list(n))
|
||||||
report.append('')
|
report.append('')
|
||||||
|
|||||||
@@ -138,6 +138,13 @@ def main(argv=sys.argv[1:]):
|
|||||||
default=None,
|
default=None,
|
||||||
help='output filename, defaults to stdout',
|
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)
|
_build_query_arg_group(do_report)
|
||||||
do_report.set_defaults(func=report.report_cmd)
|
do_report.set_defaults(func=report.report_cmd)
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ def report_cmd(args, conf):
|
|||||||
conf,
|
conf,
|
||||||
versions,
|
versions,
|
||||||
title='Release Notes',
|
title='Release Notes',
|
||||||
|
show_source=args.show_source,
|
||||||
)
|
)
|
||||||
if args.output:
|
if args.output:
|
||||||
with open(args.output, 'w') as f:
|
with open(args.output, 'w') as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user