diff --git a/index.js b/index.js index cc0f8a2..9ebe6a0 100644 --- a/index.js +++ b/index.js @@ -148,7 +148,7 @@ module.exports = class Cli { //-- Get binary name static get binName() { - return STATIC.pkg.name; + return Object.keys(STATIC.pkg.bin)[0]; } @@ -176,7 +176,7 @@ module.exports = class Cli { return Math.max(...lengths); })(); - let usage = `Usage: ${chalk.yellow(STATIC.pkg.name)} ${chalk.cyan('')}\n`; + let usage = `Usage: ${chalk.yellow(this.binName)} ${chalk.cyan('')}\n`; Object.keys(STATIC.fullUsage).forEach((group) => { usage += `\n${chalk.underline(group)}\n`; @@ -187,7 +187,7 @@ module.exports = class Cli { }); if (STATIC.showBin) { - usage += `\n${STATIC.pkg.name}@${STATIC.pkg.version} ${STATIC.pkgPath}`; + usage += `\n${this.binName}@${STATIC.pkg.version} ${STATIC.pkgPath}`; } return usage; @@ -215,10 +215,10 @@ module.exports = class Cli { })(); Object.values(STATIC.commands[task]).forEach((subtask) => { - usage += `${chalk.yellow(`${STATIC.pkg.name}`)} ${cmdUsage(`${task} ${subtask[0]}`, length, 3)}\n`; + usage += `${chalk.yellow(`${this.binName}`)} ${cmdUsage(`${task} ${subtask[0]}`, length, 3)}\n`; }); } else { - usage += `${chalk.yellow(STATIC.pkg.name)} ${cmdUsage(task, 0, 2)}\n`; + usage += `${chalk.yellow(this.binName)} ${cmdUsage(task, 0, 2)}\n`; } return indentString(usage, 2); diff --git a/package.json b/package.json index ddee04e..b01852a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@absolunet/cli", - "version": "0.7.1", + "version": "0.8.0", "description": "CLI utilities", "definition": "", "homepage": "https://github.com/absolunet/node-cli", @@ -20,20 +20,20 @@ "url": "https://github.com/absolunet/node-cli/issues" }, "engines": { - "node": ">= 10.7.0" + "node": ">= 10.10.0" }, "main": "index.js", "scripts": { "test": "ava" }, "devDependencies": { - "@absolunet/tester": "2.0.3" + "@absolunet/tester": "2.1.1" }, "dependencies": { "@absolunet/terminal": "^0.5.0", "@absolunet/terminal-pad": "^0.0.2", "chalk": "^2.4.1", - "glob": "^7.1.2", + "glob": "^7.1.3", "indent-string": "^3.2.0", "omelette": "^0.4.11", "ow": "^0.6.0",