Comparing version 1.7.3 to 1.7.4
@@ -63,3 +63,4 @@ const mri = require('mri'); | ||
if (!this.curr) throw new Error('Cannot call `alias()` before defining a command'); | ||
this.tree[this.curr].alibi = this.tree[this.curr].alibi.concat(...names); | ||
let arr = this.tree[this.curr].alibi = this.tree[this.curr].alibi.concat(...names); | ||
arr.forEach(key => this.tree[key] = this.curr); | ||
return this; | ||
@@ -122,16 +123,14 @@ } | ||
// Loop thru possible command(s) | ||
let k, i=1, len=argv._.length + 1; | ||
let i=1, xyz, len=argv._.length + 1; | ||
for (; i < len; i++) { | ||
tmp = argv._.slice(0, i).join(' '); | ||
if (this.tree[tmp] !== void 0) { | ||
name=tmp; idx=arr.indexOf(tmp, 1); | ||
} else { | ||
for (k in this.tree) { | ||
if (this.tree[k].alibi.includes(tmp)) { | ||
idx = arr.indexOf(tmp); | ||
arr.splice(idx, 1, ...k.split(' ')); | ||
name = k; | ||
break; | ||
} | ||
} | ||
xyz = this.tree[tmp]; | ||
if (typeof xyz === 'string') { | ||
idx = (name=xyz).split(' '); | ||
arr.splice(arr.indexOf(argv._[0]), i, ...idx); | ||
i += (idx.length - i); | ||
} else if (xyz) { | ||
name = tmp; | ||
} else if (name) { | ||
break; | ||
} | ||
@@ -138,0 +137,0 @@ } |
@@ -56,12 +56,13 @@ const GAP = 4; | ||
if (!single && key === DEF) { | ||
// General help :: print all non-internal commands & their 1st line of text | ||
let cmds = Object.keys(tree).filter(k => !/__/.test(k)); | ||
let text = cmds.map(k => [k, (tree[k].describe || [''])[0]]); | ||
out += section('Available Commands', format(text), noop); | ||
let key, rgx=/^__/, help='', cmds=[]; | ||
// General help :: print all non-(alias|internal) commands & their 1st line of helptext | ||
for (key in tree) { | ||
if (typeof tree[key] == 'string' || rgx.test(key)) continue; | ||
if (cmds.push([key, (tree[key].describe || [''])[0]]) < 3) { | ||
help += (NL + __ + __ + `${pfx} ${key} --help`); | ||
} | ||
} | ||
out += (NL + __ + 'For more info, run any command with the `--help` flag'); | ||
cmds.slice(0, 2).forEach(k => { | ||
out += (NL + __ + __ + `${pfx} ${k} --help`); | ||
}); | ||
out += NL; | ||
out += section('Available Commands', format(cmds), noop); | ||
out += (NL + __ + 'For more info, run any command with the `--help` flag') + help + NL; | ||
} else if (!single && key !== DEF) { | ||
@@ -68,0 +69,0 @@ // Command help :: print its aliases if any |
{ | ||
"name": "sade", | ||
"version": "1.7.3", | ||
"version": "1.7.4", | ||
"description": "Smooth (CLI) operator 🎶", | ||
@@ -14,3 +14,3 @@ "repository": "lukeed/sade", | ||
"email": "luke.edwards05@gmail.com", | ||
"url": "lukeed.com" | ||
"url": "https://lukeed.com" | ||
}, | ||
@@ -17,0 +17,0 @@ "scripts": { |
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
29581