Browse files

optional cli args

  • Loading branch information...
1 parent 878213e commit 859aaa2576c412b2207889272cffb9260eb98cb2 @Shogun147 committed Dec 13, 2013
Showing with 23 additions and 25 deletions.
  1. +23 −25 lib/cli-args.js
View
48 lib/cli-args.js
@@ -14,31 +14,33 @@ var cmd = require('commander');
// });
cmd
- .option('-u, --url <url>', 'Base URL')
- .option('-http, --http <bool>', 'Enable/Disable HTTP', bool)
- .option('-h, --http-host <host>', 'HTTP Host')
- .option('-p, --http-port <port>', 'HTTP Port', parseInt)
- .option('-https, --https <bool>', 'Enable/Disable HTTPS', bool)
- .option('-sh, --https-host <host>', 'HTTPS Host')
- .option('-sp, --https-port <port>', 'HTTPS Port', parseInt)
- .option('-skey, --https-key <key>', 'HTTPS Private Key')
- .option('-scert, --https-cert <cert>', 'HTTPS Public x509 Certificate')
- .option('-sca, --https-ca <ca>', 'HTTPS Authority Certificate')
- .option('-c, --cookies <bool>', 'Enable/Disable cookies', bool)
- .option('-s, --session <bool>', 'Enable/Disable session', bool)
- .option('-m, --multiparser <bool>', 'Enable/Disable multiparser', bool)
- .option('-s, --statics <bool>', 'Enable/Disable statics', bool)
+ .option('-u, --url <url>', 'Base URL')
+ .option(' --http [bool]', 'Enable/Disable HTTP', bool)
+ .option('-h, --http-host <host>', 'HTTP Host')
+ .option('-p, --http-port <port>', 'HTTP Port', parseInt)
+ .option(' --https [bool]', 'Enable/Disable HTTPS', bool)
+ .option(' --https-host <host>', 'HTTPS Host')
+ .option(' --https-port <port>', 'HTTPS Port', parseInt)
+ .option(' --https-key <key>', 'HTTPS Private Key')
+ .option(' --https-cert <cert>', 'HTTPS Public x509 Certificate')
+ .option(' --https-ca <ca>', 'HTTPS Authority Certificate')
+ .option('-c, --cookies [bool]', 'Enable/Disable cookies', bool)
+ .option('-s, --session [bool]', 'Enable/Disable session', bool)
+ .option('-m, --multiparser [bool]', 'Enable/Disable multiparser', bool)
+ .option('-t, --statics [bool]', 'Enable/Disable statics', bool)
.parse(process.argv);
-cmd.on('--help', function() {
- console.log(cmd.helpInformation());
- process.exit();
-});
-
['httpsKey', 'httpsCert', 'httpsCa'].forEach(function(key) {
cmd[key] && (cmd[key] = Fs.readFileSync(App.root + cmd[key]));
});
+(cmd.http !== undefined) && App.set('http', cmd.http);
+(cmd.https !== undefined) && App.set('https', cmd.https);
+(cmd.cookies !== undefined) && App.set('cookies enabled', cmd.cookies);
+(cmd.session !== undefined) && App.set('session enabled', cmd.session);
+(cmd.multiparser !== undefined) && App.set('multiparser enabled', cmd.multiparser);
+(cmd.statics !== undefined) && App.set('statics enabled', cmd.statics);
+
cmd.url && App.set('baseUrl', cmd.url);
cmd.httpHost && App.set('http host', cmd.httpHost);
cmd.httpPort && App.set('http port', cmd.httpPort);
@@ -47,9 +49,5 @@ cmd.httpsPort && App.set('https port', cmd.httpsPort);
cmd.httpsKey && App.set('https key', cmd.httpsKey);
cmd.httpsCert && App.set('https cert', cmd.httpsCert);
cmd.httpsCa && App.set('https ca', cmd.httpsCa);
-(cmd.http !== undefined) && App.set('http', cmd.http);
-(cmd.https !== undefined) && App.set('https', cmd.https);
-(cmd.cookies !== undefined) && App.set('cookies enabled', cmd.cookies);
-(cmd.session !== undefined) && App.set('session enabled', cmd.session);
-(cmd.multiparser !== undefined) && App.set('multiparser enabled', cmd.multiparser);
-(cmd.statics !== undefined) && App.set('statics enabled', cmd.statics);
+
+

0 comments on commit 859aaa2

Please sign in to comment.