Comparing version 1.0.5 to 1.0.6
30
index.js
#!/usr/bin/env node | ||
var prompt = require('prompt'); | ||
var program= require('./lib/arg'); | ||
var help= require('./lib/help'); | ||
var _p = require('./lib/arg'); | ||
var help = require('./lib/help'); | ||
var func = require('./lib/func')(_p); | ||
//console.log(program); | ||
if(program.options['h'] || program.options['help'] || program.options['V'] || program.options['version']){ | ||
help(program); | ||
if((!_p.options.length && !_p.command) || _p.options.h || _p.options.help || _p.options.v || _p.options.version){ | ||
help(_p); | ||
process.exit(); | ||
} | ||
if (program.command=='init') { | ||
prompt.message = '> '; | ||
prompt.delimiter=' '; | ||
prompt.start(); | ||
prompt.get(['name','email'], function (err, result) { | ||
console.log('Command-line input received:'); | ||
console.log(' name: ' + result.name); | ||
console.log(' email: ' + result.email); | ||
}); | ||
} | ||
func.initCLI(function(){ | ||
var cmd = require('./lib/cmd')(func); | ||
if (_p.command && cmd[_p.command]) { | ||
cmd[_p.command](); | ||
} else { | ||
help(_p); | ||
} | ||
}); |
@@ -15,3 +15,3 @@ var util = require('util'); | ||
if (!util.isArray(x.options[k])) { | ||
x.options[k]=[x.options[k]] | ||
x.options[k]=[x.options[k]]; | ||
} | ||
@@ -22,3 +22,3 @@ if (v!==true) { | ||
} | ||
}; | ||
} | ||
function arg(a,v){ | ||
@@ -44,9 +44,9 @@ x.arguments[a]=v; | ||
last=smin[1]; | ||
opt(smin[1]) | ||
opt(smin[1]); | ||
} | ||
} else if (sminmin && sminmin.length && sminmin[1]) { | ||
last=sminmin[1]; | ||
opt(sminmin[1]) | ||
opt(sminmin[1]); | ||
} else if(sarg && sarg.length > 2){ | ||
arg(sarg[1],sarg[2]) | ||
arg(sarg[1],sarg[2]); | ||
} else { | ||
@@ -59,3 +59,7 @@ opt(last,val); | ||
}); | ||
if (x.options['']) { | ||
x.subcommand=x.options['']; | ||
delete(x.options['']); | ||
} | ||
return x; | ||
}()); |
@@ -0,28 +1,64 @@ | ||
var util = require('util'); | ||
var help=require('./../help.json'); | ||
function srepeat(s,n) { | ||
return (new Array(n+1).join(s)); | ||
} | ||
function showHelp(h) { | ||
function format1(hs,s) { | ||
if (!util.isArray(hs)) { | ||
hs=[hs]; | ||
} | ||
console.log('\n'+s+hs[0]); | ||
for(var i=1;i<hs.length;i++){ | ||
console.log(srepeat(' ',s.length)+hs[i]); | ||
} | ||
} | ||
function format2(hs,s,l) { | ||
l=l||3; | ||
if (!util.isArray(hs)) { | ||
hs=[hs]; | ||
} | ||
console.log('\n'+s); | ||
for(var i=0;i<hs.length;i++){ | ||
console.log((srepeat(' ',3))+hs[i]); | ||
} | ||
} | ||
if (h.usage) { | ||
format1(h.usage,' Usage: '); | ||
} | ||
if (h.description) { | ||
format1(h.description,' '); | ||
} | ||
if (h.options) { | ||
format2(h.options,' Options: '); | ||
} | ||
if (h.notes) { | ||
var hs=h.notes; | ||
if (!util.isArray(hs)) { | ||
hs=[hs]; | ||
} | ||
for(var i=0;i<hs.length;i++){ | ||
if (!(hs[i].title)) { | ||
console.log('\n '+hs[i]); | ||
} else { | ||
format2(hs[i].content,' '+hs[i].title); | ||
} | ||
} | ||
} | ||
console.log(''); | ||
} | ||
module.exports=function(p){ | ||
p=p||{options:{},command:'',arguments:[]}; | ||
var s=''; | ||
if (p.options['V'] || p.options['version']) { | ||
s='esm version:1.0.2'; | ||
} else if (p.command=='init') { | ||
s='\n Usage: esm init\n'; | ||
if (p.options.v || p.options.version && !p.command) { | ||
console.log('esm version:'+help.version); | ||
} else if(!p.command){ | ||
showHelp(help); | ||
} else if (help.commands[p.command]) { | ||
showHelp(help.commands[p.command]); | ||
} else { | ||
s= '\n'+ | ||
' Usage: esm [options|<command> [arguments]]\n\n'+ | ||
' esm command line interface\n\n'+ | ||
' where <command> is one of:\n'+ | ||
' add-user, adduser, apihelp, author, bin, bugs, c, cache,\n'+ | ||
' completion, config, ddp, dedupe, deprecate, docs, edit,\n'+ | ||
' explore, faq, find, find-dupes, get, help, help-search,\n'+ | ||
' home, i, info, init, install, issues, la, link, list, ll,\n'+ | ||
' ln, login, ls, outdated, owner, pack, prefix, prune,\n'+ | ||
' publish, r, rb, rebuild, remove, repo, restart, rm, root,\n'+ | ||
' run-script, s, se, search, set, show, shrinkwrap, star,\n'+ | ||
' stars, start, stop, t, tag, test, tst, un, uninstall,\n'+ | ||
' unlink, unpublish, unstar, up, update, v, version, view,\n'+ | ||
' whoami\n\n'+ | ||
' Options:\n'+ | ||
' -h, --help output usage information\n'+ | ||
' -V, --version output the version number\n'; | ||
console.log('no command found'); | ||
} | ||
console.log(s); | ||
}; |
{ | ||
"name": "esm", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "emobiq service manager", | ||
"main": "index.js", | ||
"bin": "index.js", | ||
"bin": { | ||
"esm": "./bin/esm" | ||
}, | ||
"scripts": { | ||
"test": "node ./node_modules/tad/bin/tad" | ||
"start": "node ./index.js", | ||
"test": "tad" | ||
}, | ||
@@ -14,7 +17,18 @@ "keywords": [ | ||
"dependencies": { | ||
"cli-color": "^1.0.0", | ||
"prompt": "^0.2.14" | ||
"colors": "~1.1.2", | ||
"fstream": "~1.0.7", | ||
"jshint": "~2.8.0", | ||
"mute-stream": "~0.0.4", | ||
"ncp": "^2.0.0", | ||
"osenv": "~0.1.2", | ||
"request": "~2.57.0", | ||
"tar": "~2.1.1", | ||
"tough-cookie": "~2.0.0", | ||
"tough-cookie-filestore": "~0.0.1", | ||
"uglify-js": "~2.4.23" | ||
}, | ||
"devDependencies": { | ||
"tad": "^0.2.2" | ||
"gulp": "~3.9.0", | ||
"gulp-jshint": "~1.11.0", | ||
"tad": "~0.2.2" | ||
}, | ||
@@ -21,0 +35,0 @@ "author": "Agus Made <krisnaparta@gmail.com>", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances 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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
27369
21
1103
0
4
11
3
5
2
+ Addedcolors@~1.1.2
+ Addedfstream@~1.0.7
+ Addedjshint@~2.8.0
+ Addedmute-stream@~0.0.4
+ Addedncp@^2.0.0
+ Addedosenv@~0.1.2
+ Addedrequest@~2.57.0
+ Addedtar@~2.1.1
+ Addedtough-cookie@~2.0.0
+ Addeduglify-js@~2.4.23
+ Addedamdefine@1.0.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedasn1@0.1.11(transitive)
+ Addedassert-plus@0.1.5(transitive)
+ Addedasync@0.9.2(transitive)
+ Addedaws-sign2@0.5.0(transitive)
+ Addedbl@0.9.5(transitive)
+ Addedblock-stream@0.0.9(transitive)
+ Addedbluebird@2.11.0(transitive)
+ Addedboom@2.10.1(transitive)
+ Addedcamelcase@1.2.1(transitive)
+ Addedcaseless@0.10.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedcli@0.6.6(transitive)
+ Addedcolors@1.1.2(transitive)
+ Addedcombined-stream@0.0.71.0.8(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedconsole-browserify@1.1.0(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedcryptiles@2.0.5(transitive)
+ Addedctype@0.5.3(transitive)
+ Addeddate-now@0.1.4(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddelayed-stream@0.0.51.0.0(transitive)
+ Addeddom-serializer@0.2.2(transitive)
+ Addeddomelementtype@1.3.12.3.0(transitive)
+ Addeddomhandler@2.3.0(transitive)
+ Addeddomutils@1.5.1(transitive)
+ Addedentities@1.0.02.2.0(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedexit@0.1.2(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@0.2.0(transitive)
+ Addedfstream@1.0.12(transitive)
+ Addedgenerate-function@2.3.1(transitive)
+ Addedgenerate-object-property@1.2.0(transitive)
+ Addedglob@3.2.11(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhar-validator@1.8.0(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhawk@2.3.1(transitive)
+ Addedhoek@2.16.3(transitive)
+ Addedhtmlparser2@3.8.3(transitive)
+ Addedhttp-signature@0.11.0(transitive)
+ Addedis-my-ip-valid@1.0.1(transitive)
+ Addedis-my-json-valid@2.20.6(transitive)
+ Addedis-property@1.0.2(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedjshint@2.8.0(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsonpointer@5.0.1(transitive)
+ Addedlodash@3.7.0(transitive)
+ Addedlru-cache@2.7.3(transitive)
+ Addedmime-db@1.12.0(transitive)
+ Addedmime-types@2.0.14(transitive)
+ Addedminimatch@0.3.02.0.10(transitive)
+ Addedncp@2.0.0(transitive)
+ Addednode-uuid@1.4.8(transitive)
+ Addedoauth-sign@0.8.2(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedosenv@0.1.5(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@3.1.0(transitive)
+ Addedreadable-stream@1.0.341.1.14(transitive)
+ Addedrequest@2.57.0(transitive)
+ Addedshelljs@0.3.0(transitive)
+ Addedsigmund@1.0.1(transitive)
+ Addedsntp@1.0.9(transitive)
+ Addedsource-map@0.1.34(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedstringstream@0.0.6(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedstrip-json-comments@1.0.4(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedtar@2.1.1(transitive)
+ Addedtough-cookie@0.12.12.0.0(transitive)
+ Addedtough-cookie-filestore@0.0.1(transitive)
+ Addedtunnel-agent@0.4.3(transitive)
+ Addeduglify-js@2.4.24(transitive)
+ Addeduglify-to-browserify@1.0.2(transitive)
+ Addedwindow-size@0.1.0(transitive)
+ Addedwordwrap@0.0.2(transitive)
+ Addedxtend@4.0.2(transitive)
+ Addedyargs@3.5.4(transitive)
- Removedcli-color@^1.0.0
- Removedprompt@^0.2.14
- Removedarray-buffer-byte-length@1.0.1(transitive)
- Removedavailable-typed-arrays@1.0.7(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removedcli-color@1.4.0(transitive)
- Removedcolors@0.6.2(transitive)
- Removedcycle@1.0.3(transitive)
- Removedd@1.0.2(transitive)
- Removeddeep-equal@2.2.3(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-get-iterator@1.1.3(transitive)
- Removedes5-ext@0.10.64(transitive)
- Removedes6-iterator@2.0.3(transitive)
- Removedes6-symbol@3.1.4(transitive)
- Removedes6-weak-map@2.0.3(transitive)
- Removedesniff@2.0.1(transitive)
- Removedevent-emitter@0.3.5(transitive)
- Removedext@1.7.0(transitive)
- Removedeyes@0.1.8(transitive)
- Removedfor-each@0.3.3(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedfunctions-have-names@1.2.3(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedgopd@1.0.1(transitive)
- Removedhas-bigints@1.0.2(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedi@0.3.7(transitive)
- Removedinternal-slot@1.0.7(transitive)
- Removedis-arguments@1.1.1(transitive)
- Removedis-array-buffer@3.0.4(transitive)
- Removedis-bigint@1.0.4(transitive)
- Removedis-boolean-object@1.1.2(transitive)
- Removedis-callable@1.2.7(transitive)
- Removedis-date-object@1.0.5(transitive)
- Removedis-map@2.0.3(transitive)
- Removedis-number-object@1.0.7(transitive)
- Removedis-promise@2.2.2(transitive)
- Removedis-regex@1.1.4(transitive)
- Removedis-set@2.0.3(transitive)
- Removedis-shared-array-buffer@1.0.3(transitive)
- Removedis-string@1.0.7(transitive)
- Removedis-symbol@1.0.4(transitive)
- Removedis-weakmap@2.0.2(transitive)
- Removedis-weakset@2.0.3(transitive)
- Removedisarray@2.0.5(transitive)
- Removedlru-queue@0.1.0(transitive)
- Removedmemoizee@0.4.17(transitive)
- Removedncp@0.4.2(transitive)
- Removednext-tick@1.1.0(transitive)
- Removedobject-inspect@1.13.3(transitive)
- Removedobject-is@1.1.6(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedobject.assign@4.1.5(transitive)
- Removedpkginfo@0.3.10.4.1(transitive)
- Removedpossible-typed-array-names@1.0.0(transitive)
- Removedprompt@0.2.14(transitive)
- Removedread@1.0.7(transitive)
- Removedregexp.prototype.flags@1.5.3(transitive)
- Removedrevalidator@0.1.8(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedset-function-name@2.0.2(transitive)
- Removedside-channel@1.0.6(transitive)
- Removedstack-trace@0.0.10(transitive)
- Removedstop-iteration-iterator@1.0.0(transitive)
- Removedtimers-ext@0.1.8(transitive)
- Removedtype@2.7.3(transitive)
- Removedutile@0.2.1(transitive)
- Removedwhich-boxed-primitive@1.0.2(transitive)
- Removedwhich-collection@1.0.2(transitive)
- Removedwhich-typed-array@1.1.15(transitive)
- Removedwinston@0.8.3(transitive)