Comparing version 0.0.2 to 0.0.3
27
cli.js
@@ -37,7 +37,32 @@ #!/usr/bin/env node | ||
function printList() { | ||
const groupBy = require('lodash.groupby'); | ||
const sortBy = require('lodash.sortby'); | ||
const commands = getCommands(); | ||
const groups = Object.entries(groupBy(Object.entries(commands), ([command]) => { | ||
const parts = command.split(':'); | ||
return parts.length === 1 ? '_' : parts[0]; | ||
})); | ||
const noPrefix = groups.find(_ => _[0] === '_') || ['_', []]; | ||
const prefixed = sortBy(groups.filter(_ => _[0] !== '_'), '[0]'); | ||
console.log(); | ||
Object.entries(commands).forEach(([command, info]) => { | ||
sortBy(noPrefix[1], '[0]').forEach(([command, info]) => { | ||
console.log(`- ${command} (${info.description})`); | ||
}); | ||
let prevLength = noPrefix[1].length; | ||
prefixed.forEach(([, commands]) => { | ||
if (prevLength > 1) { | ||
console.log(); | ||
} | ||
sortBy(commands, '[0]').forEach(([command, info]) => { | ||
console.log(`- ${command} (${info.description})`); | ||
}); | ||
prevLength = commands.length; | ||
}); | ||
} | ||
@@ -44,0 +69,0 @@ |
{ | ||
"name": "belt-cli", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Minimalistic extendable CLI script runner", | ||
@@ -15,4 +15,6 @@ "main": "cli.js", | ||
"configstore": "^3.1.2", | ||
"lodash.groupby": "^4.6.0", | ||
"lodash.sortby": "^4.7.0", | ||
"minimist": "^1.2.0" | ||
} | ||
} |
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
3394
80
4
+ Addedlodash.groupby@^4.6.0
+ Addedlodash.sortby@^4.7.0
+ Addedlodash.groupby@4.6.0(transitive)
+ Addedlodash.sortby@4.7.0(transitive)