From 57be4b5905372c20b77eb4bbbe8c5a076ea86483 Mon Sep 17 00:00:00 2001 From: Typicode Date: Sun, 29 Dec 2013 05:33:44 +0100 Subject: [PATCH] Update messages --- bin/cli.js | 11 ++++++++--- utils/logger.js | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/cli.js b/bin/cli.js index 26e78af..8089406 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -36,12 +36,12 @@ function saveDbOnCommand(app) { process.stdin.resume(); 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) { if (userInput.trim().toLowerCase() == 's') { 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'; console.assert(liveDB, 'expected live db object'); fs.writeFileSync(filename, @@ -66,7 +66,12 @@ program .option('--read-only', 'read only mode'); 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); diff --git a/utils/logger.js b/utils/logger.js index 3e2b10c..20a1200 100644 --- a/utils/logger.js +++ b/utils/logger.js @@ -4,6 +4,7 @@ logan.set({ error: ['%', 'red'], success: ['%', 'green'], info: ['%', 'grey'], + notice: ['%', 'yellow'], url: [' http://localhost:%/'.grey + '%'.cyan, '.'] })