Skip to content

Commit

Permalink
Add simple parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Techniv committed Dec 6, 2013
1 parent ba24f69 commit 4af81a1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
.idea
/.project
/.settings
/nbproject
Expand Down
50 changes: 27 additions & 23 deletions index.js
Expand Up @@ -108,31 +108,35 @@ function cmdConf(cmd){
};

function processConfItem(item){

switch(item.action){
case 'get':
if(item.number == undefined){
logger.error('The number of get action is\' defined for \''+item.name+'\'.');

if(typeof item.action == 'string' && typeof item.key == 'string'){

switch(item.action){
case 'get':
if(item.number == undefined){
logger.error('The number of get action is\' defined for \''+item.name+'\'.');
return false;
}
break;
case 'set':
if(item.value == undefined){
logger.warn('The set value of \''+item.name+' is not defined. Use true.');
item.value = true;
}
break;
default:
logger.error('The config property '+item.name+' has no action');
return false;
}
break;
case 'set':
if(item.value == undefined){
logger.warn('The set value of \''+item.name+' is not defined. Use true.');
item.value = true;
}
break;
default:
logger.error('The config property '+item.name+' has no action');
return false;
break;
break;
}

conf.key[item.key] = item;
if(item.shortKey) conf.shortKey[item.shortKey] = item;

if(item.defaultValue !== undefined) setParam(item.name, item.defaultValue);
} else {
setParam(item.name, item);
}

conf.key[item.key] = item;
if(item.shortKey) conf.shortKey[item.shortKey] = item;


if(item.defaultValue !== undefined) setParam(item.name, item.defaultValue);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "cmd-conf",
"description": "A command line analyser for Node.JS",
"version": "0.3.0",
"version": "0.4.0-dev",
"author": "Vincent Peybernes [Techniv] <vpeybernes.pro@gmail.com>",
"url": "https://github.com/Techniv/node-cmd-conf",
"repository": {"type": "git", "url": "https://github.com/Techniv/node-cmd-conf.git"},
Expand Down

0 comments on commit 4af81a1

Please sign in to comment.