Update messages

This commit is contained in:
Typicode
2013-12-29 05:33:44 +01:00
parent 739485e1fe
commit 57be4b5905
2 changed files with 9 additions and 3 deletions

View File

@ -36,12 +36,12 @@ function saveDbOnCommand(app) {
process.stdin.resume(); process.stdin.resume();
process.stdin.setEncoding('utf8'); process.stdin.setEncoding('utf8');
console.log('type "s then ENTER" to save live database at any moment'); logger.notice('To save live database at any moment, enter `s`');
process.stdin.on('data', function (userInput) { process.stdin.on('data', function (userInput) {
if (userInput.trim().toLowerCase() == 's') { if (userInput.trim().toLowerCase() == 's') {
var liveDB = app.db(); var liveDB = app.db();
var now = moment().format('YYYY-MM-DD:HH-mm-ss') var now = moment().format('YYYY-MM-DD-HH:mm:ss')
var filename = 'json-server.' + now + '.json'; var filename = 'json-server.' + now + '.json';
console.assert(liveDB, 'expected live db object'); console.assert(liveDB, 'expected live db object');
fs.writeFileSync(filename, fs.writeFileSync(filename,
@ -66,7 +66,12 @@ program
.option('--read-only', 'read only mode'); .option('--read-only', 'read only mode');
program.on('--help', function () { program.on('--help', function () {
console.log(pkg.name, '[options] filename.json or filename.js or json ULR'); var examples =
' Examples:\n\n' +
' json-server --file db.json\n' +
' json-server --file seed.js\n' +
' json-server --url http://example.com/db.json\n'
console.log(examples);
}); });
program.parse(process.argv); program.parse(process.argv);

View File

@ -4,6 +4,7 @@ logan.set({
error: ['%', 'red'], error: ['%', 'red'],
success: ['%', 'green'], success: ['%', 'green'],
info: ['%', 'grey'], info: ['%', 'grey'],
notice: ['%', 'yellow'],
url: [' http://localhost:%/'.grey + '%'.cyan, '.'] url: [' http://localhost:%/'.grey + '%'.cyan, '.']
}) })