Skip to content

Commit

Permalink
Add a screenshot filename switch
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Feb 19, 2024
1 parent fe0aecc commit 731fe5a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/textual_dev/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ def _pre_run_warnings() -> None:
metavar="PATH",
help="The target location for the screenshot",
)
@click.option(
"--screenshot-filename",
type=click.Path(path_type=pathlib.Path),
default=None,
metavar="NAME",
help="The filename for the screenshot",
)
@click.option(
"-c",
"--command",
Expand Down Expand Up @@ -152,6 +159,7 @@ def _run_app(
press: str | None,
screenshot: int | None,
screenshot_location: pathlib.Path | None,
screenshot_filename: pathlib.Path | None,
extra_args: tuple[str],
command: bool = False,
show_return: bool = False,
Expand Down Expand Up @@ -204,6 +212,8 @@ def _run_app(
environment["TEXTUAL_SCREENSHOT"] = str(screenshot)
if screenshot_location is not None:
environment["TEXTUAL_SCREENSHOT_LOCATION"] = str(screenshot_location)
if screenshot_filename is not None:
environment["TEXTUAL_SCREENSHOT_FILENAME"] = str(screenshot_filename)
if show_return:
environment["TEXTUAL_SHOW_RETURN"] = "1"

Expand Down

0 comments on commit 731fe5a

Please sign in to comment.