SPB Git

Repository Public

drive.sh 1.1 KB 16 lines shellscript

1#!/bin/bash2# Sends keystrokes to the running SP Term through System Events (used by the smoke tests).3#   Scripts/drive.sh type "text"      types text then Return4#   Scripts/drive.sh key d command    key with modifiers (comma separated: command,shift,option,control)5#   Scripts/drive.sh code 36          raw key code, optional modifiers as 3rd argument6set -euo pipefail7mods() { local out="" x; for x in $(echo "${1:-}" | tr "," " "); do out+="${out:+, }$x down"; done; echo "$out"; }8osascript -e 'tell application "SP Term" to activate' >/dev/null; sleep 0.259case "$1" in10  type) osascript -e "tell application \"System Events\" to keystroke \"$2\"" -e 'tell application "System Events" to key code 36' ;;11  text) osascript -e "tell application \"System Events\" to keystroke \"$2\"" ;;12  key) m="$(mods "${3:-}")"; u=""; [ -n "$m" ] && u=" using {$m}"; osascript -e "tell application \"System Events\" to keystroke \"$2\"$u" ;;13  code) m="$(mods "${3:-}")"; u=""; [ -n "$m" ] && u=" using {$m}"; osascript -e "tell application \"System Events\" to key code $2$u" ;;14esac15sleep "${DRIVE_DELAY:-0.5}"16
Files main
Menu

Theme