Permalink
Browse files

added help message function

  • Loading branch information...
1 parent 30fc1af commit 02d39a5a856c0afbfb23b600a2c06cfd1435e606 @xianhuazhou committed Jan 12, 2013
Showing with 11 additions and 7 deletions.
  1. +11 −7 lib/jmen.js
View
@@ -13,6 +13,10 @@ JMEN_VERSION = '0.3.0';
console.log("[" + (new Date()).toLocaleTimeString() + "] " + msg);
}
+ function help(msg) {
+ console.log(msg);
+ }
+
function getTempFile(f) {
var tmpFiles = f.split('/');
var tmpFile = '.' + tmpFiles.pop();
@@ -21,17 +25,17 @@ JMEN_VERSION = '0.3.0';
}
function printVersion() {
- puts('jmen version: ' + JMEN_VERSION + " on " + os.type() + " " + os.release() + ", nodejs: " + process.version);
+ help('jmen version: ' + JMEN_VERSION + " on " + os.type() + " " + os.release() + ", nodejs: " + process.version);
}
function printHelp() {
printVersion();
- puts("Usage: node jmen.js --file <file> [options]");
- puts(" --file | -f\t\tsource file path");
- puts("options:");
- puts(" --output | -o\t\ttarget file to save the final result");
- puts(" --encoding | -n\tfile encoding, default is utf8");
- puts(" --compress | -c\tcompress the generated code");
+ help("Usage: node jmen.js --file <file> [options]");
+ help(" --file | -f\t\tsource file path");
+ help("options:");
+ help(" --output | -o\t\ttarget file to save the final result");
+ help(" --encoding | -n\tfile encoding, default is utf8");
+ help(" --compress | -c\tcompress the generated code");
process.exit(0);
}

0 comments on commit 02d39a5

Please sign in to comment.