it2 text inject
Inject data into a session as if it came from the program
Synopsis
it2 text inject <session-id> <data> [flags]
Description
Inject data directly into a session's output stream, as if the running program had produced it. Supports hex-encoded data with --hex flag.
Options
-
--format(default "table") - Output format (table|json|yaml|text)
-
--hex - Treat data as hex-encoded bytes
-
--timeout(default "5s") - Command timeout
-
--url(default "ws://localhost:1912") - iTerm2 WebSocket URL
See Also
- it2 text - Text and buffer operations in iTerm2
Examples
# Inject text into session
$ it2 text inject abc123 "Hello World"
# Inject ANSI color codes
$ it2 text inject abc123 $'\033[31mRed Text\033[0m'
# Inject hex-encoded data
$ it2 text inject --hex abc123 "48656c6c6f"
# Inject newline
$ it2 text inject abc123 $'\n'
# Inject escape sequence
$ it2 text inject abc123 $'\033[2J'
# Inject with JSON output
$ it2 text inject --format json abc123 "test"