diff --git a/check_times.py b/check_times.py index 2b3d2f9..e3bbaea 100644 --- a/check_times.py +++ b/check_times.py @@ -10,6 +10,7 @@ $ python check_times.py """ +import argparse import gzip import tomllib from pathlib import Path @@ -78,17 +79,36 @@ def calc_time(lines: list[str]) -> None: if __name__ == "__main__": - print("Build times (HTML only; English)") - print("=======================") - print() - calc_time(get_lines("docsbuild-only-html-en.log")) - - print("Build times (HTML only)") - print("=======================") - print() - calc_time(get_lines("docsbuild-only-html.log")) - - print("Build times (no HTML)") - print("=====================") - print() - calc_time(get_lines("docsbuild-no-html.log")) + parser = argparse.ArgumentParser( + description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter + ) + ALL_BUILDS = ("no-html", "only-html", "only-html-en") + parser.add_argument( + "--select-output", + choices=ALL_BUILDS, + nargs="*", + help="Choose what builds to show (default: all).", + ) + args = parser.parse_args() + parser.suggest_on_error = True + + if not args.select_output: + args.select_output = ALL_BUILDS + + if "only-html-en" in args.select_output: + print("Build times (HTML only; English)") + print("=======================") + print() + calc_time(get_lines("docsbuild-only-html-en.log")) + + if "only-html" in args.select_output: + print("Build times (HTML only)") + print("=======================") + print() + calc_time(get_lines("docsbuild-only-html.log")) + + if "no-html" in args.select_output: + print("Build times (no HTML)") + print("=====================") + print() + calc_time(get_lines("docsbuild-no-html.log"))
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: