-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f67b962
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Created by cc on 14-5-13. | ||
*/ | ||
'use strict'; | ||
var M_Message = require("k-m-message"); | ||
function _check(){ | ||
var res_key = 0; | ||
var argv = process.argv; | ||
argv = argv.slice(2,argv.length); | ||
for(var i = 0; i < argv.length; i++){ | ||
var item = argv[i].split("="); | ||
this.data[item[0]] = item[1]; | ||
} | ||
if(this.file){ | ||
var data = M_File.read(this.file); | ||
for(var i in data){ | ||
if(typeof this.data[i] != "undefined"){ | ||
this.data[i] = data[i]; | ||
} | ||
} | ||
} | ||
for(var i in this.data){ | ||
if(!this.data[i]){ | ||
res_key = 1; | ||
console.log(i+"未知"); | ||
break; | ||
} | ||
} | ||
return M_Message.getMessage(res_key,message); | ||
} | ||
var M_File = require("k-m-file"); | ||
var message = ["成功","参数有误"]; | ||
|
||
module.exports = { | ||
file:"", | ||
data:{}, | ||
check:_check | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "k-m-argv", | ||
"version": "0.0.2", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"dependencies": { | ||
"k-m-file": "^0.0.2", | ||
"k-m-message": "*" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/285858315/k-m-argv.git" | ||
}, | ||
"keywords": [ | ||
"k-m" | ||
], | ||
"author": "[email protected]", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/285858315/k-m-argv/issues" | ||
}, | ||
"homepage": "https://github.com/285858315/k-m-argv" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Created by cc on 14-5-13. | ||
*/ | ||
'use strict'; | ||
var main = require("./index.js"); | ||
main.data = { | ||
port:"", | ||
host:"", | ||
time:60000,//默认一分钟 | ||
remote_user_id:"", | ||
remote_shop_id:"" | ||
}; | ||
var res = main.check(); | ||
if(res.key == 1){ | ||
|
||
|
||
} |