Files
095-assignment-space-invaders/tools/take-screenshot.sh
Tirsvad b09dae6c8a
TirSystem/git-workflows: CI / secret-scan (push) Skipped
TirSystem/git-workflows: CI / validate (push) Skipped
TirSystem/git-workflows: CI / opengrep (push) Skipped
TirSystem/git-workflows: CI / release-check (push) Skipped
TirSystem/git-workflows: Publish wiki / publish-wiki (push) Skipped
TirSystem/git-workflows: Release / release (push) Skipped
TirSystem/git-workflows: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Tests / test (pull_request) Successful in 41s
TirSystem/git-workflows: CI / secret-scan (pull_request) Successful in 11s
TirSystem/git-workflows: Release / release (pull_request) Successful in 7s
TirSystem/git-workflows: CI / validate (pull_request) Successful in 19s
TirSystem/git-workflows: Publish accepted milestones / publish (push) Skipped
TirSystem/git-workflows: Validate / validate (push) Skipped
TirSystem/git-workflows: Validate / validate (pull_request) Successful in 20s
TirSystem/git-workflows: OpenGrep / opengrep (pull_request) Successful in 58s
TirSystem/git-workflows: CI / release-check (pull_request) Successful in 7s
TirSystem/git-workflows: CI / opengrep (pull_request) Successful in 49s
Split the screenshot script so shellcheck and shfmt pass
2026-11-21 17:10:05 +08:00

16 lines
599 B
Bash

#!/usr/bin/env bash
# Runs inside the Docker image of tools/Dockerfile.
# Usage: take-screenshot.sh <name> [seconds] [xdotool key names...]
# name output file docs/images/<name>.png
# seconds how long the game runs before the picture is taken (default 3)
# keys xdotool key names pressed after one second, e.g. Left Left space
set -euo pipefail
name=${1:?usage: take-screenshot.sh <name> [seconds] [keys...]}
seconds=${2:-3}
shift $(($# < 2 ? $# : 2))
mkdir -p docs/images
xvfb-run -a -s "-screen 0 1024x768x24" \
bash tools/capture.sh "docs/images/${name}.png" "${seconds}" "$@"