Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fenwick67/xplat-cli
cross platform cli
https://github.com/fenwick67/xplat-cli
Last synced: about 1 month ago
JSON representation
cross platform cli
- Host: GitHub
- URL: https://github.com/fenwick67/xplat-cli
- Owner: fenwick67
- Created: 2016-06-25T17:56:14.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-07-02T03:36:15.000Z (over 8 years ago)
- Last Synced: 2024-10-29T08:05:01.871Z (about 2 months ago)
- Language: JavaScript
- Size: 896 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# xplat-cli
Cross platform command line interface.
Creates a cli that can use nodejs command line, AND works in a browser with Browserify.
Inspired by [Vorpal](https://github.com/dthree/vorpal), which I couldn't get to work in a browser because it's so dependent on `tty` and `readline`.
## API
An example is probably easier than a formal spec. Look at test/test.js for an example (also try out test/index.html, which is just browserified)
```
var cli = require('xplat-cli')();cli
.delimiter('>')// set the delimiter
.command('get',function(arguments,done){// crate a command called "get"
var program = this;
program.writeln('loading...');
function dot(){
program.write('.');
}
var timer = setInterval(dot,1000);
setTimeout(function(){
clearInterval(timer);
program.writeln(' done!');
done(null);
}),5000)
});
```
## Notes
.delimiter doesn't work in terminal right now