JSDOC/Options.js
authorAlan Knowles <alan@akbkhome.com>
Wed, 30 Jun 2010 08:55:32 +0000 (16:55 +0800)
committerAlan Knowles <alan@akbkhome.com>
Wed, 30 Jun 2010 08:55:32 +0000 (16:55 +0800)
JSDOC/Options.js

index 757ec91..abacb33 100644 (file)
@@ -86,5 +86,62 @@ Options = {
             };
         }
         
-    }
+    },
+    /** 
+     *  this might be nice as a standard bit of code..
+     */
+       
+    parseArgv : function(){
+        
+        var args = Array.prototype.slice.call(Seed.argv);
+        args.shift(); //seed
+        args.shift(); // pack.js
+        var cfg = {
+            files : [],
+            target : false,
+        }
+
+
+        for(var i =0; i < args.length;i++) {
+            if (args[i] == '-o') {
+                cfg.target = args[i+1];
+                i++;
+                continue;
+            }
+            if (args[i] == '-O') {
+                cfg.debugTarget = args[i+1];
+                i++;
+                continue;
+            }
+            if (args[i] == '-t') {
+                cfg.translateJSON = args[i+1];
+                i++;
+                continue;
+            }
+            if (args[i] == '-w') {
+                cfg.tmpDir = args[i+1];
+                i++;
+                continue;
+            }
+            if (args[i] == '-p') {
+                cfg.prefix = args[i+1];
+                i++;
+                continue;
+            }
+         
+            if (args[i] == '-C') {
+                cfg.cleanup = false;
+                continue;
+            }
+            if (args[i] == '-f') {
+                cfg.srcfile = args[i+1];
+                i++;
+                continue;
+            }
+            if (cfg.files.indexOf(args[i]) > -1) {
+                continue; // remove dupes.
+            }
+            cfg.files.push(args[i]);
+        }
+    
 }
\ No newline at end of file