Skip to content

Commit f30347c

Browse files
committed
Add a screenshot location argument to the textual command
1 parent e4622c7 commit f30347c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/textual_dev/cli.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import pathlib
34
import platform
45
import 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

0 commit comments

Comments
 (0)