Skip to content

winton/commandland

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

commandland

I make executing commands look good.

Nah

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)

Releases

No releases published

Packages

No packages published