Permalink
Browse files

Moved around CLI handler into a YUIDoc class so it can be called from…

… options.
  • Loading branch information...
davglass committed Mar 17, 2011
1 parent fccc38f commit fcb494826bc9bdf01c66bdf9cba24c8dec24f0f1
Showing with 247 additions and 135 deletions.
  1. +60 −0 lib/cli.js
  2. +0 −3 lib/docparser.js
  3. +183 −126 lib/yuidoc.js
  4. +4 −6 package.json
View
@@ -0,0 +1,60 @@
+#!/usr/bin/env node
+
+var YUI = require("yui3").YUI,
+ fs = require("fs"),
+ sys = require("sys"),
+ path = require("path");
+
+YUI({
+ modules: {
+ docparser: {
+ fullpath: path.join(__dirname, 'docparser.js'),
+ requires: ['base-base', 'json-stringify']
+ },
+ yuidoc: {
+ fullpath: path.join(__dirname, 'yuidoc.js')
+ }
+ },
+ logExclude: {
+ yui: true,
+ get: true,
+ loader: true
+ }
+}).use('docparser', 'yuidoc', function(Y) {
+
+ var args = Y.Array(process.argv, 2),
+ options = {
+ paths: []
+ };
+
+ while (args.length > 0) {
+ var v = args.shift();
+ switch (v) {
+ case "-e":
+ case "--extension":
+ options.extension = args.shift();
+ break;
+ case "-x":
+ case "--exclude":
+ options.extension = args.shift();
+ break;
+ case "-v":
+ case "--version":
+ options.version = args.shift();
+ break;
+ case "-n":
+ case "--norecurse":
+ options.norecurse = true;
+ break;
+ case "-o":
+ case "--outdir":
+ options.outdir = args.shift();
+ break;
+ default:
+ options.paths.push(v);
+ }
+ }
+
+
+ (new Y.YUIDoc(options)).run();
+});
View
@@ -22,7 +22,6 @@ YUI.add('docparser', function(Y) {
* during initialization, and will be updated if additional
* digesters are added.
* @property TAGLIST
- * @inner
* @final
*/
TAGLIST = [
@@ -95,7 +94,6 @@ YUI.add('docparser', function(Y) {
/**
* Common errors will get scrubbed instead of being ignored.
* @property CORRECTIONS
- * @inner
* @final
*/
CORRECTIONS = {
@@ -116,7 +114,6 @@ YUI.add('docparser', function(Y) {
* by supplying the string name that points to the
* implementation rather than a function.
* @property DIGESTERS
- * @inner
* @final
*/
DIGESTERS = {
Oops, something went wrong.

0 comments on commit fcb4948

Please sign in to comment.