Licence
MIT
Version
0.1.3
Deps
1
Size
8 kB
Vulns
0
Weekly
0
commandland
I make executing commands look good.

| Feature |
|---|
| Live stdout with ASCII colors |
| Live stdin |
| (Or keep live stdout/stdin silent) |
| Capture output as string |
| Exit code and signal capture |
| Session record & playback |
Run a command
import { run } from "commandland"
let { code, out } = await run("ls", ["/"])
Execution options
| Option | Example | Purpose |
|---|---|---|
| args | ["/"] |
Command arguments |
| command | "ls" |
Command to execute |
| cols, rows | 100, 100 |
Column and rows for pty |
| cwd | process.env.HOME |
Working directory for pty |
| env | process.env |
Environment for pty |
| onData | ()=>{} |
Pty data callback |
| record | false |
Record the session |
| silent | false |
Execute without stdout |
| stdin | false |
Allow stdin input |
Replay a session
import { run, replay } from "commandland"
let { session } = await run("ls", ["/"], { record: true })
await replay(session)