mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(cloudcmd) add -p, --port
This commit is contained in:
parent
1d1cde506f
commit
01b5fd0be0
1 changed files with 24 additions and 3 deletions
|
|
@ -10,13 +10,22 @@
|
|||
|
||||
Util = require(DIR_LIB + 'util'),
|
||||
|
||||
config = {},
|
||||
|
||||
argv = process.argv,
|
||||
length = argv.length - 1,
|
||||
argvLast = argv[length];
|
||||
argvLast = argv.slice().pop();
|
||||
|
||||
switch (argvLast) {
|
||||
default:
|
||||
start();
|
||||
if (isPort(argv)) {
|
||||
if (argvLast - 0 > 0)
|
||||
config.port = argvLast;
|
||||
else
|
||||
console.log('Error: port should be a number.');
|
||||
}
|
||||
|
||||
start(config);
|
||||
|
||||
break;
|
||||
|
||||
case '--test':
|
||||
|
|
@ -47,4 +56,16 @@
|
|||
cloudcmd.start(params);
|
||||
}
|
||||
|
||||
function isPort(argv) {
|
||||
var length = argv.length,
|
||||
str = argv
|
||||
.slice(length - 2, length - 1)
|
||||
.pop(),
|
||||
|
||||
PORT = ['-p', '--port'],
|
||||
is = Util.strCmp(str, PORT);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue