flatiron-cli-config
Encapsulated commands for managing configuration in flatiron CLI apps
Example
At its core flatiron-cli-config
is a broadway-compatible plugin which can be used by any flatiron
application:
var flatiron = require('flatiron'),
app = flatiron.app;
app.name = 'app.js';
app.config.file({ file: 'test-config.json' });
app.use(flatiron.plugins.cli, {
usage: 'A simple CLI app using flatiron-cli-config'
});
app.use(require('flatiron-cli-config'));
if (!module.parent) {
app.start();
}
If you run the above script:
$ node app.js config set foo bar
$ node app.js config get foo
The output will be:
data: foo bar
And the contents of test-config.json
will be:
{ "foo": "bar" }
API Documentation
Commands exposed
$ node examples/app.js help config
help: `app.js config *` commands allow you to edit your
help: local app.js configuration file. Valid commands are:
help:
help: app.js config list
help: app.js config set <key> <value>
help: app.js config get <key>
help: app.js config delete <key>
Options
{
store: 'file'
restricted: ['foo', 'bar'],
before: { list: function () { ... } }
}
Installation
Installing npm (node package manager)
curl http://npmjs.org/install.sh | sh
Installing flatiron-cli-config
[sudo] npm install flatiron-cli-config
Run Tests
Tests are written in vows and give complete coverage of all APIs and storage engines.
$ npm test
License: MIT