Skip to content

Commit 731fe5a

Browse files
committed
Add a screenshot filename switch
1 parent fe0aecc commit 731fe5a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/textual_dev/cli.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ def _pre_run_warnings() -> None:
125125
metavar="PATH",
126126
help="The target location for the screenshot",
127127
)
128+
@click.option(
129+
"--screenshot-filename",
130+
type=click.Path(path_type=pathlib.Path),
131+
default=None,
132+
metavar="NAME",
133+
help="The filename for the screenshot",
134+
)
128135
@click.option(
129136
"-c",
130137
"--command",
@@ -152,6 +159,7 @@ def _run_app(
152159
press: str | None,
153160
screenshot: int | None,
154161
screenshot_location: pathlib.Path | None,
162+
screenshot_filename: pathlib.Path | None,
155163
extra_args: tuple[str],
156164
command: bool = False,
157165
show_return: bool = False,
@@ -204,6 +212,8 @@ def _run_app(
204212
environment["TEXTUAL_SCREENSHOT"] = str(screenshot)
205213
if screenshot_location is not None:
206214
environment["TEXTUAL_SCREENSHOT_LOCATION"] = str(screenshot_location)
215+
if screenshot_filename is not None:
216+
environment["TEXTUAL_SCREENSHOT_FILENAME"] = str(screenshot_filename)
207217
if show_return:
208218
environment["TEXTUAL_SHOW_RETURN"] = "1"
209219

0 commit comments

Comments
 (0)