Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Use bin name instead of package name
Browse files Browse the repository at this point in the history
  • Loading branch information
jblandry committed Sep 17, 2018
1 parent 8931b13 commit ea0ce5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}


Expand Down Expand Up @@ -176,7 +176,7 @@ module.exports = class Cli {
return Math.max(...lengths);
})();

let usage = `Usage: ${chalk.yellow(STATIC.pkg.name)} ${chalk.cyan('<command>')}\n`;
let usage = `Usage: ${chalk.yellow(this.binName)} ${chalk.cyan('<command>')}\n`;

Object.keys(STATIC.fullUsage).forEach((group) => {
usage += `\n${chalk.underline(group)}\n`;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit ea0ce5a

Please sign in to comment.