mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
support -v option; provide more detailed version info (#303)
This commit is contained in:
parent
dd4b4a4f60
commit
b814da3e8b
6
jsdoc.js
6
jsdoc.js
@ -113,6 +113,7 @@ function main() {
|
||||
var exampleConf;
|
||||
var filter;
|
||||
var i;
|
||||
var info;
|
||||
var l;
|
||||
var packageDocs;
|
||||
var packageJson;
|
||||
@ -216,8 +217,9 @@ function main() {
|
||||
include('test/runner.js');
|
||||
process.exit(0);
|
||||
} else if (env.opts.version) {
|
||||
var info = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
|
||||
console.log(info.version);
|
||||
info = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
|
||||
info.revision = new Date(parseInt(info.revision, 10)).toUTCString();
|
||||
console.log('JSDoc ' + info.version + ' (' + info.revision + ')');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ argParser.addOption('h', 'help', false, 'Print this message and quit.');
|
||||
argParser.addOption('X', 'explain', false, 'Dump all found doclet internals to console and quit.');
|
||||
argParser.addOption('q', 'query', true, 'A query string to parse and store in env.opts.query. Example: foo=bar&baz=true', false, parseQuery);
|
||||
argParser.addOption('u', 'tutorials', true, 'Directory in which JSDoc should search for tutorials.');
|
||||
argParser.addOption(null,'version', false, 'Display the version number and quit.');
|
||||
argParser.addOption('v', 'version', false, 'Display the version number and quit.');
|
||||
|
||||
//TODO [-R, recurseonly] = a number representing the depth to recurse
|
||||
//TODO [-f, filter] = a regex to filter on <-- this can be better defined in the configs?
|
||||
|
||||
@ -233,6 +233,13 @@ describe("jsdoc/opts/args", function() {
|
||||
expect(r.nocolor).toEqual(true);
|
||||
});
|
||||
|
||||
it("should accept a '-v' option and return an object with a 'version' property", function() {
|
||||
args.parse(['-v']);
|
||||
var r = args.get();
|
||||
|
||||
expect(r.version).toEqual(true);
|
||||
});
|
||||
|
||||
it("should accept a '--version' option and return an object with a 'version' property", function() {
|
||||
args.parse(['--version']);
|
||||
var r = args.get();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user