···1313npm link
1414```
15151616+Or install directly from GitHub:
1717+1818+```sh
1919+npm install -g github:myobie/pty
2020+```
2121+2222+Requires Node.js. Works on macOS and Linux.
2323+1624## Usage
2525+2626+Run `pty` with no arguments to launch the interactive session manager:
2727+2828+```
2929+╭─ pty ────────────────────────────────────────────────────────────╮
3030+│ │
3131+│ Filter: (type to filter) │
3232+│ │
3333+│ ● webserver ~/projects/myapp node server.js │
3434+│ ● worker ~/projects/myapp npm run worker │
3535+│ ● devlog ~/projects/myapp tail -f log/dev.log │
3636+│ ○ migrations (exited 2h ago) npm run migrate │
3737+│ + Create new session... │
3838+│ │
3939+╰──────────────────────────────────────────────────────────────────╯
4040+ ↑↓ select ⏎ attach q quit
4141+```
4242+4343+Arrow keys to navigate, type to filter, Enter to attach, `q` to quit. Creating a new session walks through a directory picker and name/command prompt.
4444+4545+When you detach from a session entered via the interactive list (`Ctrl+\`), you return to the list. The session keeps running in the background.
4646+4747+### Commands
17481849```sh
1919-pty run myserver -- node server.js # start a session and attach
2020-pty run -d myserver -- node server.js # start in the background
5050+pty # interactive session manager
5151+pty run myserver -- node server.js # start a session and attach
5252+pty run -d myserver -- node server.js # start in the background
5353+pty run -a myserver -- node server.js # create or attach if already running
21542222-pty # no args runs list
2323-pty list # show active sessions
5555+pty list # show active sessions
5656+pty list --json # show as JSON
24572525-pty attach myserver # reconnect
2626-pty peek myserver # print current screen and exit
2727-pty peek -f myserver # follow output read-only
5858+pty attach myserver # reconnect to a session
5959+pty attach -r myserver # reconnect, auto-restart if exited
6060+pty peek myserver # print current screen and exit
6161+pty peek --plain myserver # print as plain text (no ANSI)
6262+pty peek -f myserver # follow output read-only
28632929-pty send myserver "hello" # send text (no implicit newline)
3030-pty send myserver $'hello\n' # send text with newline (shell syntax)
6464+pty send myserver "hello" # send text (no implicit newline)
6565+pty send myserver $'hello\n' # send text with newline (shell syntax)
3166pty send myserver --seq "git status" --seq key:return # ordered sequence
3232-pty send myserver --seq key:ctrl+c # send control keys
6767+pty send myserver --seq key:ctrl+c # send control keys
33683434-pty restart myserver # restart an exited session
3535-pty kill myserver # terminate a session
6969+pty restart myserver # restart an exited session
7070+pty kill myserver # terminate a session
3671```
37723873Detach with `Ctrl+\`. (Press `Ctrl+\` twice to send it through to the process.)
···4075## Tab Completion
41764277```sh
4343-brew install bash-completion # required for bash; zsh works out of the box
7878+brew install bash-completion # required for bash on macOS; zsh works out of the box
4479npm run install-completions
4580```
4681