Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
285858315 committed Sep 28, 2015
0 parents commit f67b962
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
38 changes: 38 additions & 0 deletions index.js
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
}
26 changes: 26 additions & 0 deletions package.json
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"
}
17 changes: 17 additions & 0 deletions test.js
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){


}

0 comments on commit f67b962

Please sign in to comment.