Skip to content

Commit

Permalink
Added -q/--quiet argument to disable logging
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Apr 12, 2012
1 parent 9935889 commit 2e630ee
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ while (args.length > 0) {
var theme = args.shift();
options.themedir = path.join(__dirname, '../', 'themes', theme);
break;
case "-q":
case "--quiet":
options.quiet = true;
break;
default:
if (!options.paths) {
options.paths = [];
Expand All @@ -104,6 +108,10 @@ while (args.length > 0) {
}
}

if (options.quiet) {
Y.applyConfig({ debug: false });
}

Y.log('Starting YUIDoc@' + Y.packageInfo.version + ' using YUI@' + Y.version + ' with NodeJS@' + process.versions.node, 'info', 'yuidoc');

var starttime = (new Date).getTime();
Expand Down
1 change: 1 addition & 0 deletions lib/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ YUI.add('help', function(Y) {
" -o, --out <directory path> Path to put the generated files (defaults to ./out)",
" -t, --themedir <directory path> Path to a custom theme directory containing Handlebars templates",
" -h, --help Show this help",
" -q, --quiet Supress logging output",
" -T, --theme <simple|default> Choose one of the built in themes (default is default)",
" --server <port> Fire up the YUIDoc server for faster API doc developement. Pass optional port to listen on. (default is 3000)",
"",
Expand Down
3 changes: 2 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ var YUI = require('yui').YUI,
process.on('uncaughtException', function(msg) {
var Y = YUI(),
meta = JSON.parse(fs.readFileSync(metaPath));


Y.applyConfig({ debug: true });
Y.log('--------------------------------------------------------------------------', 'error');
Y.log('An uncaught YUIDoc error has occurred, stack trace given below', 'error');
Y.log('--------------------------------------------------------------------------', 'error');
Expand Down
7 changes: 7 additions & 0 deletions lib/yuidoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ YUI.add('yuidoc', function(Y) {
*/

var OPTIONS = {
quiet: false,
writeJSON: true,
outdir: path.join(process.cwd(), 'out'),
extension: '.js',
Expand Down Expand Up @@ -99,6 +100,12 @@ YUI.add('yuidoc', function(Y) {
*/
this.options = Y.merge(OPTIONS, config);

if (this.options.quiet) {
Y.applyConfig({
debug: false
});
}

};

Y.YUIDoc.prototype = {
Expand Down

0 comments on commit 2e630ee

Please sign in to comment.