Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thypon/aparser
An async ARGV node.js parser
https://github.com/thypon/aparser
argv async async-argv-parser nodejs
Last synced: 21 days ago
JSON representation
An async ARGV node.js parser
- Host: GitHub
- URL: https://github.com/thypon/aparser
- Owner: thypon
- Created: 2011-09-10T16:56:37.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2012-06-23T13:10:37.000Z (over 12 years ago)
- Last Synced: 2024-08-11T00:47:46.585Z (3 months ago)
- Topics: argv, async, async-argv-parser, nodejs
- Language: JavaScript
- Homepage:
- Size: 104 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Aparser
An async ARGV parser
## Installation
``` bash
$ [sudo] npm install aparser -g
```
## Usage```javascript
var aparser = require('aparser');
var puts = require('util').puts/* aparser object it's an instance of EventEmitter */
/* example with modifier,
if the string after -g it's another modifier the -g itself it's turned in a argument without minus symbol
*/
aparser.on('-g', function(arg, index) {
puts('the string with -g modifier is '+arg);
});/* example with a command */
aparser.on('start', function(arg, index) {
puts('script '+arg+'ed');
});/* example with a simple argument
'argument' event it's a command catch-all
*/
aparser.on('argument', function(arg, index) {
puts('the '+index+' argument is'+ arg);
});aparser.parser(process.argv);
```then executing it
``` bash
$ node -g ciao start
the string with -g modifier is ciao
script started
the 3 argument is start
```
#### Author: [Andrea Brancaleoni][0][0]: http://goblog.heroku.com