Changed prompt lib, updated cli's

- fixes #252
This commit is contained in:
Wyatt Johnson
2017-01-30 17:46:09 -07:00
parent b75557912f
commit e6ef4b615f
14 changed files with 282 additions and 213 deletions
-51
View File
@@ -1,51 +0,0 @@
#!/usr/bin/env node
/**
* Module dependencies.
*/
const program = require('commander');
const mongoose = require('../services/mongoose');
const SettingsService = require('../services/settings');
const util = require('../util');
// Register the shutdown criteria.
util.onshutdown([
() => mongoose.disconnect()
]);
//==============================================================================
// Setting up the program command line arguments.
//==============================================================================
program
.command('init')
.description('initilizes the talk settings')
.action(() => {
const defaults = {
moderation: 'POST',
wordlist: {
banned: [],
suspect: []
}
};
SettingsService
.init(defaults)
.then(() => {
console.log('Created settings object.');
util.shutdown();
})
.catch((err) => {
console.error(`failed to create the settings object ${JSON.stringify(err)}`);
util.shutdown(1);
});
});
program.parse(process.argv);
// If there is no command listed, output help.
if (!process.argv.slice(2).length) {
program.outputHelp();
util.shutdown();
}