Skip to content

mvertes/co-shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

co-shell

Build Status

Extend node.js core REPL module to support promises, co and yield statements.

Both executable and module for use in programs are provided.

Install

$ npm install [-g] co-shell

Usage

Install some promized stuff, for example mz:

$ npm install mz

Then run the provided bin/co-shell executable. Adjust first line #!/usr/local/bin/node --harmony if necessary.

$ co-shell
co-shell> fs = require('mz/fs')
co-shell> a = yield fs.readFile('/etc/hosts', 'utf-8')
co-shell> console.log(a)

API

Using co-shell in a program is quite simple. Lets build a shell as above, enabling access to mz/fs:

var coshell = require('co-shell');
var context = coshell({prompt: 'co-shell> '}).context;

context.fs = require('mz/fs');

coshell(options) has exactly the same syntax as repl.start(options) in core REPL. Please refer to the original documentation for further details.

License

MIT license.

About

yield and promise enabled node REPL extension

Resources

License

Stars

Watchers

Forks

Packages

No packages published