Skip to content

eirikb/js-shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-shell (js)Build Status

Pipe terminal commands into JavaScript

Install

$ npm i -g js-shell

Usage

$ ls | js 'lines.map(line => line.toUpperCase())' 

Variables

These are the variables passed into the context of the script:
data: One string of all the incoming data.
items: Incoming data split into array from newlines, then each line contains line (whole line) and parts which is the line split by whitespace.
lines: Incoming data split into array from newlines. parts: Incoming data split into array from newlines, then each line is split by whitespace (two-dimensional array). console: Directly mapped console for convenience, e.g., lines.forEach(line => console.log(line)).

Examples

Find all files larger than 10K Imgur

Parse JSON (similar to jq) Imgur

Stringify JSON (similar to jo) Imgur

Related

Similar to iostreamer-X/Awkward except this is meant to be used between pipes of other commands, e.g., while doing bash scripting.

License

MIT © Eirik Brandtzæg

About

Pipe terminal commands into JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published