From ebcfc2c7a143ea9f3b16fa8f9a37947476d6254c Mon Sep 17 00:00:00 2001 From: Gabriel Wicke Date: Tue, 28 Feb 2012 14:24:37 +0000 Subject: [PATCH] Improve grepper documentation. --- tests/parser/dumpGrepper.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/parser/dumpGrepper.js b/tests/parser/dumpGrepper.js index 759455593b..dd64f57467 100644 --- a/tests/parser/dumpGrepper.js +++ b/tests/parser/dumpGrepper.js @@ -1,3 +1,9 @@ +/** + * A simple dump grepper based on the DumpReader module. + * + * @author Gabriel Wicke + */ + var dumpReader = require('./dumpReader.js'), events = require('events'), optimist = require('optimist'), @@ -22,18 +28,23 @@ DumpGrepper.prototype.grepRev = function ( revision ) { module.exports.DumpGrepper = DumpGrepper; if (module === require.main) { - var argv = optimist.usage( 'Usage: $0 ', { + var argv = optimist.usage( 'Usage: zcat dump.xml.gz | $0 ', { 'i': { description: 'Case-insensitive matching', 'boolean': true, 'default': false }, 'color': { - description: 'Highlight matched substring using color', + description: 'Highlight matched substring using color. Use --no-color to disable.', 'boolean': true, 'default': true } } ).argv; + + if( argv.help ) { + optimist.showHelp(); + process.exit( 0 ); + } var flags = ''; if(argv.i) {