@@ -82,34 +82,32 @@ def calc_time(lines: list[str]) -> None:
8282 parser = argparse.ArgumentParser(
8383 description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
8484 )
85+ ALL_BUILDS = ("no-html", "only-html", "only-html-en")
8586 parser.add_argument(
86- "--html-en", action="store_true", help="Show HTML-only (English) build times"
87- )
88- parser.add_argument(
89- "--html", action="store_true", help="Show HTML-only build times"
90- )
91- parser.add_argument(
92- "--no-html", action="store_true", help="Show no-HTML build times"
87+ "--select-output",
88+ choices=ALL_BUILDS,
89+ nargs="*",
90+ help="Choose what builds to show (default: all).",
9391 )
9492 args = parser.parse_args()
93+ parser.suggest_on_error = True
9594
96- # If none specified, show all
97- if not (args.html_en or args.html or args.no_html):
98- args.html_en = args.html = args.no_html = True
95+ if not args.select_output:
96+ args.select_output = ALL_BUILDS
9997
100- if args.html_en :
98+ if "only-html-en" in args.select_output :
10199 print("Build times (HTML only; English)")
102100 print("=======================")
103101 print()
104102 calc_time(get_lines("docsbuild-only-html-en.log"))
105103
106- if args.html :
104+ if "only-html" in args.select_output :
107105 print("Build times (HTML only)")
108106 print("=======================")
109107 print()
110108 calc_time(get_lines("docsbuild-only-html.log"))
111109
112- if args.no_html :
110+ if "no-html" in args.select_output :
113111 print("Build times (no HTML)")
114112 print("=====================")
115113 print()
0 commit comments