npsx
====
[![npm](https://img.shields.io/npm/v/npsx.svg?style=flat-square)](https://npm.im/npsx)

Simple package to execute simple, interactive shell scripts written in JavaScript.

It's basically a wrapper to `shelljs` that wraps a script in an `async` block, provides 3 helper functions `say`, `choice` and `question` and exposes `shell` variable containing a reference to [shelljs](https://github.com/shelljs/shelljs).

### Usage
```bash
$ cat script.sx.js
let answer = await question('What is your name? ')
say(`Hello, ${answer}!`)
$ npsx script
What is your name? John
Hello, John!
```

### Helper functions

### `say :: (text: String) -> undefined`
Prints `text` into output.

### `question :: (text: String) -> async (answer: String)`
Prints `text` into output and awaits for input (followed by `enter`). Returns a promise of a string.

### `choice :: (text: String) -> async (answer: Boolean)`
Prints `text` into output and awaits for one of symbols from the list below. Returns a promise of a boolean.

##### Possible choices:

* `true: 'y', 'yes', 't', 'true', '1', 'ok', 'yeah'`
* `false: 'n', 'no', 'f', 'false', '0', 'not', 'nah'`
