Skip to content

Latest commit

 

History

History
75 lines (52 loc) · 1.79 KB

README.md

File metadata and controls

75 lines (52 loc) · 1.79 KB

hashpipe

Hashpipe is an experimental JSON-based shell. Imagine that Bash was designed for manipulating web APIs instead of a filesystem.

Featuring:

  • JSON-typed input & output (strings, numbers, objects, and arrays)
  • Alternative piping constructs (like the parallel pipe || and sequential pipe |=)
  • Modular design (useing modules and aliasing commands)

Getting started

Installation

$ npm install -g hashpipe
$ hashpipe
#|

At a glance

Bash-like command pipelines

#| cat names.txt | split '\n' | match John | sort
[ 'John Adams',
  'John King',
  'John Lee',
  'John Mitchell' ]

Parallel and series pipes to map commands over arrays

#| [1, 3, 4, 12] || * 5
[ 5, 15, 20, 60 ]

#|  echo john jacob jingleheimer | split ' ' || upper
[ 'JOHN', 'JACOB', 'JINGLEHEIMER' ]

Special @ syntax for traversing JSON objects and arrays

#| ['a', 'b', 'c'] @ 0
'a'

#| {name: "George", age: 55} @ name
'George'

#| [{name: "Fred"}, {name: "Jerry"}, {name: "Tim"}] @ :name
[ 'Fred', 'Jerry', 'Tim' ]

Designed for easy interaction with JSON APIs

#| get http://www.telize.com/geoip
{ country: 'United States',
  region: 'California',
  city: 'Mountain View',
  postal_code: '94043' }

#| {encoded: 'SGV5IHRoZXJl'} | post http://spro.webscript.io/base64
{ decoded: 'Hey there' }

Learning more

Try one of the Hashpipe walkthroughs to see it in action: