Added --configure option.

This commit is contained in:
Michael Mathews 2011-01-17 22:00:45 +00:00
parent 05ab6caf14
commit d57a993a1a
2 changed files with 7 additions and 4 deletions

10
main.js
View File

@ -53,7 +53,7 @@ env = {
start: new Date(),
finish: null
},
args: arguments.slice(1), // jsdoc.jar sets argument[0] to the abspath to main.js, user args follow
args: Array.prototype.slice.call(arguments, 1), // jsdoc.jar adds argument[0], the abspath to main.js, user args follow
conf: {},
opts: {}
};
@ -113,15 +113,17 @@ function main() {
}
};
env.opts = jsdoc.opts.parser.parse(env.args);
try {
env.conf = JSON.parse( require('common/fs').read(BASEDIR+'conf.json') );
env.conf = JSON.parse(
require('common/fs').read( env.opts.configure || BASEDIR+'conf.json' )
);
}
catch (e) {
throw('Configuration file cannot be evaluated. '+e);
}
env.opts = jsdoc.opts.parser.parse(env.args);
if (env.opts.query) {
env.opts.query = require('common/query').toObject(env.opts.query);
}

View File

@ -17,6 +17,7 @@
};
argsParser.addOption('t', 'template', true, 'The name of the template to use. Default: the "default" template');
argsParser.addOption('c', 'configure', true, 'The path to the configuration file. Default: jsdoc basedir + conf.json');
argsParser.addOption('e', 'encoding', true, 'Assume this encoding when reading all source files. Default: your system default encoding');
argsParser.addOption('n', 'nocode', false, 'Ignore doclets that don\'t explicitly provide a symbol name.');
argsParser.addOption('T', 'test', false, 'Run all tests and quit.');