Commit 2e2b64b
Eric Bower
·
2026-06-12 19:57:10 -0400 EDT
parent 94738e5
docs: help cmd
2 files changed,
+6,
-96
+2,
-96
1@@ -71,9 +71,9 @@ zig build -Doptimize=ReleaseSafe --prefix ~/.local
2 > [!IMPORTANT]
3 > We recommend closing the terminal window to detach from the session but you can also press `ctrl+\` or run `zmx detach`.
4
5-```
6-zmx - session persistence for terminal processes
7+Run `zmx help` for more information on usage, with examples.
8
9+```
10 Usage: zmx <command> [args...]
11
12 Commands:
13@@ -91,100 +91,6 @@ Commands:
14 [c]ompletions <shell> Shell completions (bash, zsh, fish)
15 [v]ersion Show version
16 [h]elp Show this help
17-
18-Attach:
19- This will spawn a login $SHELL with a PTY. You can provide a
20- command instead of creating a shell.
21-
22- Examples:
23- zmx attach dev
24- zmx attach dev vim
25-
26-History:
27- This should generally be used with `tail` to print the last lines
28- of the session's scrollback history.
29-
30- Examples:
31- zmx history <session> | tail -100
32-
33-Run:
34- Commands are passed as-is: do not wrap in quotes.
35- Commands run sequentially: do not send multiple in parallel.
36- Avoid interactive programs (pagers, editors, prompts): they hang.
37-
38- `--fish` is required when the session runs fish shell.
39-
40- If the command hangs, send Ctrl+C to recover:
41- zmx run <session> $(printf '\x03')
42-
43- If the command hangs, print the history to see the error:
44- zmx history <session> | tail -100
45-
46- `-d` will detach from the calling terminal. Use `wait` to track
47- its status.
48-
49- Examples:
50- zmx run dev ls
51- zmx run dev --fish ls src
52- zmx run dev zig build
53- zmx run dev grep -r TODO src
54- zmx run dev git -c core.pager=cat diff
55-
56-Send:
57- Sends raw text to the session's PTY input (fire-and-forget).
58- Unlike `run`, no completion marker is appended and no exit code
59- is tracked. Useful for TUI applications, interactive prompts,
60- or any program that reads stdin directly.
61-
62- Text is sent byte-for-byte with no automatic carriage return.
63- Append \r yourself when you want the shell to execute a command.
64-
65- Text can also be piped via stdin:
66- printf 'ls -la\r' | zmx send dev
67-
68- Examples:
69- printf 'echo hello\r' | zmx send dev
70- zmx send dev $(printf '\x03')
71- zmx send dev /compact
72-
73-Print:
74- Injects text directly into the session display and scrollback.
75- Never touches the PTY input -- the shell sees nothing.
76- Caller is responsible for newlines (\\r\\n).
77-
78- Examples:
79- printf '\\r\\nhello\\r\\n' | zmx print dev
80- zmx print dev "$(printf '\\r\\nalert\\r\\n')"
81-
82-Write:
83- Writes stdin to file_path inside the session. Works over SSH.
84- file_path can be absolute or relative to the session shell's cwd.
85- Requires base64 and printf in the remote environment.
86- Large files are chunked automatically (~48KB per chunk).
87- File path must not contain single quotes.
88-
89- Examples:
90- echo "hello" | zmx write dev /tmp/hello.txt
91- cat main.zig | zmx write dev src/main.zig
92-
93-Wait:
94- Used with a detached run task to track its status. Multiple
95- sessions can be provided.
96-
97- Examples:
98- zmx run -d dev sleep 10
99- zmx wait dev
100- zmx wait dev other
101-
102-Environment variables:
103- SHELL Default shell for new sessions
104- ZMX_DIR Socket directory (priority 1)
105- XDG_RUNTIME_DIR Socket directory (priority 2)
106- TMPDIR Socket directory (priority 3)
107- ZMX_SESSION Session name (injected automatically)
108- ZMX_SESSION_PREFIX Prefix added to all session names
109- ZMX_DIR_MODE Sets mode for socket and log directories (octal, defaults to 0750)
110- ZMX_LOG_MODE Sets mode for log files (octal, defaults to 0640)
111 ```
112
113 ## shell prompt
+4,
-0
1@@ -1279,6 +1279,7 @@ fn help() !void {
2 \\ zmx history <session> | tail -100
3 \\
4 \\Run:
5+ \\ Commands run inside a PTY using bash
6 \\ Commands are passed as-is: do not wrap in quotes.
7 \\ Commands run sequentially: do not send multiple in parallel.
8 \\ Avoid interactive programs (pagers, editors, prompts): they hang.
9@@ -1298,6 +1299,9 @@ fn help() !void {
10 \\ zmx run dev grep -r TODO src
11 \\ zmx run dev git -c core.pager=cat diff
12 \\
13+ \\ zmx run dev -d sleep 10
14+ \\ zmx wait dev
15+ \\
16 \\Send:
17 \\ Sends raw text to the session's PTY input (fire-and-forget).
18 \\ Unlike `run`, no completion marker is appended and no exit code