Skip to content

Commit f9dd587

Browse files
committed
cli: fix alignment in top-level help and document -e and --
The Typical workflow example had `-e` placed after the data, which read awkwardly, and the # comments didn't line up. Move `-e` in front of the data and pad the trailing comments to the same column. Add an Input shortcuts section so the top-level `ptywrap help` -- the one an LLM will read first -- enumerates the flags that change how input is parsed: stdin piping, `-e/--escaped`, and the `--` end-of-options marker for DATA that starts with a dash.
1 parent 39e151c commit f9dd587

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/main.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,20 @@ maintains an in-memory virtual terminal (80x24 by default), and exposes a
2222
Unix socket at ~/.ptywrap/<session>.sock for control.
2323
2424
Typical workflow:
25-
ptywrap -s s start -- bash # spawn bash in a fresh PTY
26-
ptywrap -s s write 'ls\\n' -e # type 'ls' + ENTER
27-
ptywrap -s s view --wait # see the rendered screen
28-
ptywrap -s s send-key Ctrl-C # interrupt
29-
ptywrap -s s stop # end the session
25+
ptywrap -s s start -- bash # spawn bash in a fresh PTY
26+
ptywrap -s s write -e 'ls\\n' # type 'ls' + ENTER (-e enables \\n)
27+
ptywrap -s s view --wait # see the rendered screen
28+
ptywrap -s s send-key Ctrl-C # interrupt
29+
ptywrap -s s stop # end the session
30+
31+
Input shortcuts:
32+
cat foo.txt | ptywrap -s s write # pipe a file's contents into the PTY
33+
echo done | ptywrap -s s write # read stdin when DATA is omitted or '-'
34+
ptywrap -s s write -e 'hi\\n' # -e/--escaped enables backslash
35+
# escapes: \\n \\r \\t \\xHH \\uHHHH ...
36+
ptywrap -s s write -- --escaped # use `--` to send DATA that starts
37+
# with a dash
38+
ptywrap -s s send-key ^C h i # ^X caret notation + single-char keys
3039
3140
Session lifetime:
3241
A session's daemon stays alive AFTER the child command exits, so you can

0 commit comments

Comments
 (0)