Comparing version 1.0.2 to 1.0.3
101
index.js
@@ -1,98 +0,21 @@ | ||
//var program = require('commander'); | ||
var util = require('util'); | ||
var prompt = require('prompt'); | ||
var program= require('./lib/arg'); | ||
var help= require('./lib/help'); | ||
var program=(function(){ | ||
var x={params:{},command:[]}; | ||
var stopCmd=false; | ||
var last=''; | ||
function update(k,v) { | ||
if (typeof(v)=='undefined') { | ||
v=true; | ||
} | ||
if (typeof(x.params[k])=='undefined' || x.params[k]===true) { | ||
x.params[k]=v; | ||
} else { | ||
if (!util.isArray(x.params[k])) { | ||
x.params[k]=[x.params[k]] | ||
} | ||
if (v!==true) { | ||
x.params[k].push(v); | ||
} | ||
} | ||
}; | ||
function cmd(c){ | ||
x.command.push(c); | ||
} | ||
process.argv.forEach(function(val, i, array) { | ||
if (i>1) { | ||
var smin=val.match(/^\-(\w+)/); | ||
var sminmin=val.match(/^\-\-(\w+)/); | ||
var scmd=val.match(/^(\w+)/); | ||
if (scmd && scmd.length && scmd[1] && !stopCmd) { | ||
cmd(scmd[1]); | ||
} else { | ||
stopCmd=true; | ||
if (smin && smin.length && smin[1]) { | ||
if(smin[1].length > 1){ | ||
last=''; | ||
for(var j=0;j<smin[1].length;j++){ | ||
update(smin[1][j]); | ||
} | ||
} else { | ||
last=smin[1]; | ||
update(smin[1]) | ||
} | ||
} else if (sminmin && sminmin.length && sminmin[1]) { | ||
last=sminmin[1]; | ||
update(sminmin[1]) | ||
} else { | ||
update(last,val); | ||
} | ||
} | ||
} | ||
}); | ||
return x; | ||
}()); | ||
//console.log(program); | ||
console.log(program); | ||
if(program.options['h'] || program.options['help'] || program.options['V'] || program.options['version']){ | ||
help(program); | ||
process.exit(); | ||
} | ||
//function range(val) { | ||
// return val.split('..').map(Number); | ||
//} | ||
// | ||
//function list(val) { | ||
// return val.split(','); | ||
//} | ||
// | ||
//function collect(val, memo) { | ||
// memo.push(val); | ||
// return memo; | ||
//} | ||
// | ||
//function increaseVerbosity(v, total) { | ||
// return total + 1; | ||
//} | ||
//var _init=false; | ||
// | ||
//program | ||
// .version('1.0.1') | ||
// .usage('esm <command>') | ||
// .command('init', 'init esm packages').action(function () { | ||
// console.log('tanya-tanya...'); | ||
// _init=true; | ||
// }); | ||
////program.parse(process.argv); | ||
// | ||
//process.argv.forEach(function(val, index, array) { | ||
// console.log(index + ': ' + val); | ||
//}); | ||
// | ||
if (program.command && program.command.length && program.command.indexOf('init')>-1) { | ||
if (program.command=='init') { | ||
prompt.message = '> '; | ||
prompt.delimiter=' '; | ||
prompt.start(); | ||
prompt.get(['name'], function (err, result) { | ||
prompt.get(['name','email'], function (err, result) { | ||
console.log('Command-line input received:'); | ||
console.log(' name: ' + result.name); | ||
console.log(' email: ' + result.email); | ||
}); | ||
} |
{ | ||
"name": "esm", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "emobiq service manager", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3341
4
99