@@ -39,22 +39,28 @@ def version() -> None:
3939 _print_version ()
4040
4141
42+ _input_file_argument = typer .Argument (
43+ None ,
44+ help = "An optional path to the input .py script. If not provided, must use '-c' flag." ,
45+ )
46+ _output_file_option = typer .Option (
47+ None ,
48+ "-o" ,
49+ "--output" ,
50+ help = "Path to the resulting HTML output file. Defaults to input_file with suffix replaced." ,
51+ )
52+ _command_option = typer .Option (
53+ None , "-c" , "--command" , help = "If provided, embed a single command string."
54+ )
55+ _show_option = typer .Option (None , help = "Open output file in web browser." )
56+
57+
4258@app .command ()
4359def wrap (
44- input_file : Optional [Path ] = typer .Argument (
45- None ,
46- help = "An optional path to the input .py script. If not provided, must use '-c' flag." ,
47- ),
48- command : Optional [str ] = typer .Option (
49- None , "-c" , "--command" , help = "If provided, embed a single command string."
50- ),
51- output : Optional [Path ] = typer .Option (
52- None ,
53- "-o" ,
54- "--output" ,
55- help = "Path to the resulting HTML output file. Defaults to input_file with suffix replaced." ,
56- ),
57- show : Optional [bool ] = typer .Option (None , help = "Open output file in web browser." ),
60+ input_file : Optional [Path ] = _input_file_argument ,
61+ output : Optional [Path ] = _output_file_option ,
62+ command : Optional [str ] = _command_option ,
63+ show : Optional [bool ] = _show_option ,
5864) -> None :
5965 """Wrap a Python script inside an HTML file."""
6066 if input_file is not None :
0 commit comments