htmlreport: if no arguments are passed, print --help output; when done generating the report, print where index.html is (take report_dir into account).

This commit is contained in:
Matthias Krüger 2014-07-22 01:12:27 +02:00
parent d718793540
commit 90b41aa672
1 changed files with 9 additions and 0 deletions

View File

@ -262,6 +262,13 @@ if __name__ == '__main__':
# Parse options and make sure that we have an output directory set. # Parse options and make sure that we have an output directory set.
options, args = parser.parse_args() options, args = parser.parse_args()
try:
sys.argv[1]
except IndexError: # no arguments give, print --help
parser.print_help()
quit()
if not options.report_dir: if not options.report_dir:
parser.error('No report directory set.') parser.error('No report directory set.')
@ -415,3 +422,5 @@ if __name__ == '__main__':
with io.open(os.path.join(options.report_dir, 'style.css'), with io.open(os.path.join(options.report_dir, 'style.css'),
'w') as css_file: 'w') as css_file:
css_file.write(STYLE_FILE) css_file.write(STYLE_FILE)
print("\nOpen '" + options.report_dir + "/index.html' to see the results.")