2.0.9 • Published 4 years ago

split-shell-buffer v2.0.9

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Split Shell Buffer

Splitting shell strings while preserving SGR escape sequences

Motivation

When I was creating catls, I needed to spawn a program and prints output (stdout and/or stderr) of said program to process.stdout with some prefix (e.g. indentation, bullets, numbers, etc.) whilst preserving some of UNIX control sequences (specifically, sequences that control colors).

Preview

Run one of the commands below (in top-level folder of this repository):

Usage Example

NOTE: Documentation is lacking (because I'm lazy), pull requests are welcomed.

NOTE: The following code snippets are executed in async context.

fromChildProcess

The code below spawns a program and prints output (stdout + stderr) of said program with indent.

const { stdout } = require('process')
const { spawn } = require('child_process')
const { fromChildProcess, writeln } = require('split-shell-buffer')

const cp = spawn('myprogram')
const splitter = fromChildProcess(cp).withIndent(4)

await writeln(stdout, splitter)

License

MIT © Hoàng Văn Khải

2.0.9

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago

1.0.0-rc.2

5 years ago

1.0.0-rc.1

5 years ago

1.0.0-rc.0

5 years ago

1.0.0-rc

5 years ago

0.0.0

5 years ago