@@ -82,34 +82,32 @@ def calc_time(lines: list[str]) -> None:
82
82
parser = argparse .ArgumentParser (
83
83
description = __doc__ , formatter_class = argparse .RawDescriptionHelpFormatter
84
84
)
85
+ ALL_BUILDS = ("no-html" , "only-html" , "only-html-en" )
85
86
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)." ,
93
91
)
94
92
args = parser .parse_args ()
93
+ parser .suggest_on_error = True
95
94
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
99
97
100
- if args .html_en :
98
+ if "only-html-en" in args .select_output :
101
99
print ("Build times (HTML only; English)" )
102
100
print ("=======================" )
103
101
print ()
104
102
calc_time (get_lines ("docsbuild-only-html-en.log" ))
105
103
106
- if args .html :
104
+ if "only-html" in args .select_output :
107
105
print ("Build times (HTML only)" )
108
106
print ("=======================" )
109
107
print ()
110
108
calc_time (get_lines ("docsbuild-only-html.log" ))
111
109
112
- if args .no_html :
110
+ if "no-html" in args .select_output :
113
111
print ("Build times (no HTML)" )
114
112
print ("=====================" )
115
113
print ()
0 commit comments