Permalink
Browse files

옵션 처리

  • Loading branch information...
1 parent dd2f03c commit 1ed28ba598c5f4d4c5f6823ede48da1cc2978341 @rhiokim committed Feb 8, 2012
Showing with 58 additions and 2 deletions.
  1. +2 −0 Makefile
  2. +16 −0 bin/_locally
  3. +1 −1 bin/locally
  4. +1 −1 index.js
  5. +38 −0 lib/locally.js
View
@@ -0,0 +1,2 @@
+init:
+ echo "a" >>
View
16 bin/_locally 100644 → 100755
@@ -0,0 +1,16 @@
+#!/usr/bin/env node
+
+var connect = require('connect'),
+ program = require('commander');
+
+program
+ .version('0.0.1')
+ .option('-s, --static <directory>', 'directory for serving static files', 'static')
+ .option('-d, --public <directory>', 'directory for serving public files', 'public')
+ .parse(process.argv);
+
+program.on('static', function() {
+ console.log('setting static directory');
+ process.exit();
+});
+
View
2 bin/locally 100644 → 100755
@@ -1,4 +1,4 @@
-#!usr/bin/env node
+#!/usr/bin/env node
/**
* This tiny wrapper file checks for known node flags and appends them
View
@@ -1 +1 @@
-module.exports = require('./lib/localy');
+module.exports = require('./lib/locally');
View
@@ -0,0 +1,38 @@
+var connect = require('connect'),
+ program = require('commander'),
+ fs = require('fs');
+
+/**
+ * process.argv pre process
+ */
+program
+ .version('0.0.1')
+ .option('-s, --static <directory>', 'directory for serving static files', 'static')
+ .option('-d, --public <directory>', 'directory for serving public files', 'public');
+
+program.on('--static', function() {
+ console.log('setting static directory');
+ process.exit();
+});
+
+
+// locally.opt support
+try {
+ var opts = fs.readFileSync(__dirname +'/locally.opt', 'utf8')
+ .trim()
+ .split(/\s+/);
+
+ process.argv = process.argv
+ .slice(0,2)
+ .concat(opts.concat(process.argv.slice(2)));
+} catch(err) {
+
+}
+
+program.parse(process.argv);
+
+
+/**
+ * connect binding
+ */
+

0 comments on commit 1ed28ba

Please sign in to comment.