Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonschlinkert/minimist-methods
Map your node.js application's methods to command line arguments.
https://github.com/jonschlinkert/minimist-methods
Last synced: 20 days ago
JSON representation
Map your node.js application's methods to command line arguments.
- Host: GitHub
- URL: https://github.com/jonschlinkert/minimist-methods
- Owner: jonschlinkert
- License: mit
- Created: 2015-08-07T09:27:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-15T11:34:22.000Z (about 9 years ago)
- Last Synced: 2024-10-05T03:22:07.184Z (about 1 month ago)
- Language: JavaScript
- Size: 137 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# minimist-methods [![NPM version](https://badge.fury.io/js/minimist-methods.svg)](http://badge.fury.io/js/minimist-methods)
> Map your node.js application's methods to command line arguments.
## Install
Install with [npm](https://www.npmjs.com/)
```sh
$ npm i minimist-methods --save
```## Usage example
The following example is in the [examples](./examples/namespaces.js) folder:
```js
var plugins = require('minimist-plugins');
var cache = {};var app = {
set: function(key, val) {
cache[key] = val;
},
get: function(key, val) {
return cache[key];
}
};var cli = plugins(require('minimist'))
.use(require('minimist-events')())
.use(require('..')(app))
cli.on('set', function (key) {
console.log(key);
//=> 'b'
});
cli.on('get', function (key) {
console.log(key);
//=> 'b'
});cli.parse(['--set=b', '--get=b'], function (err, argv) {
console.log(argv);
});
```## Related projects
* [minimist](https://github.com/substack/minimist): parse argument options
* [minimist-plugins](https://github.com/jonschlinkert/minimist-plugins): Simple wrapper to make minimist pluggable. ~20 sloc.
* [minimist-expand](https://github.com/jonschlinkert/minimist-expand): Expand minimist args with expand-object.
* [minimist-events](https://github.com/jonschlinkert/minimist-events): Add events to minimist, ~30 sloc.## Running tests
Install dev dependencies:
```sh
$ npm i -d && npm test
```## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/minimist-methods/issues/new)
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)## License
Copyright © 2015 Jon Schlinkert
Released under the MIT license.***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 15, 2015._