Skip to content

Commit

Permalink
Add a screenshot location argument to the textual command
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Feb 15, 2024
1 parent e4622c7 commit f30347c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/textual_dev/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import pathlib
import platform
import shlex

Expand Down Expand Up @@ -117,6 +118,13 @@ def _pre_run_warnings() -> None:
metavar="DELAY",
help="Take screenshot after DELAY seconds.",
)
@click.option(
"--screenshot-path",
type=click.Path(path_type=pathlib.Path),
default=None,
metavar="PATH",
help="The target location for the screenshot",
)
@click.option(
"-c",
"--command",
Expand All @@ -143,6 +151,7 @@ def _run_app(
port: int | None,
press: str | None,
screenshot: int | None,
screenshot_location: Path | None,
extra_args: tuple[str],
command: bool = False,
show_return: bool = False,
Expand Down Expand Up @@ -193,6 +202,8 @@ def _run_app(
environment["TEXTUAL_PRESS"] = str(press)
if screenshot is not None:
environment["TEXTUAL_SCREENSHOT"] = str(screenshot)
if screenshot_location is not None:
environment["TEXTUAL_SCREENSHOT_LOCATION"] = str(screenshot_location)
if show_return:
environment["TEXTUAL_SHOW_RETURN"] = "1"

Expand Down

0 comments on commit f30347c

Please sign in to comment.