verb
Version:
Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.
36 lines (30 loc) • 717 B
JavaScript
;
var bold = require('ansi-bold');
var cyan = require('ansi-cyan');
/**
* Get a value from the config store.
*
* ```sh
* $ --get one
* # or
* $ --get one,two,three
* ```
*/
module.exports = function(app) {
var config = app.config;
var get = app.get('argv.get');
if (get) {
if (get === true || get === 'true') {
console.log(cyan('config config:'), stringify(config.data));
} else if (get.indexOf(',') !== -1) {
get.split(',').forEach(function (val) {
console.log(val, '=', stringify(config.get(val)));
});
} else {
console.log(get, '=', stringify(config.get(get)));
}
}
};
function stringify(val) {
return bold(JSON.stringify(val));
}