File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import pathlib
34import platform
45import shlex
56
@@ -117,6 +118,13 @@ def _pre_run_warnings() -> None:
117118 metavar = "DELAY" ,
118119 help = "Take screenshot after DELAY seconds." ,
119120)
121+ @click .option (
122+ "--screenshot-path" ,
123+ type = click .Path (path_type = pathlib .Path ),
124+ default = None ,
125+ metavar = "PATH" ,
126+ help = "The target location for the screenshot" ,
127+ )
120128@click .option (
121129 "-c" ,
122130 "--command" ,
@@ -143,6 +151,7 @@ def _run_app(
143151 port : int | None ,
144152 press : str | None ,
145153 screenshot : int | None ,
154+ screenshot_location : Path | None ,
146155 extra_args : tuple [str ],
147156 command : bool = False ,
148157 show_return : bool = False ,
@@ -193,6 +202,8 @@ def _run_app(
193202 environment ["TEXTUAL_PRESS" ] = str (press )
194203 if screenshot is not None :
195204 environment ["TEXTUAL_SCREENSHOT" ] = str (screenshot )
205+ if screenshot_location is not None :
206+ environment ["TEXTUAL_SCREENSHOT_LOCATION" ] = str (screenshot_location )
196207 if show_return :
197208 environment ["TEXTUAL_SHOW_RETURN" ] = "1"
198209
You can’t perform that action at this time.
0 commit comments