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 20, 2018
1 parent 95a95cc commit 7d2ce61
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ module.exports = class Cli {

//-- Get binary name
static get binName() {
return STATIC.pkg.name;
return Object.keys(STATIC.pkg.bin)[0];
}


Expand All @@ -159,7 +159,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 @@ -170,7 +170,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 All @@ -195,10 +195,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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@absolunet/cli",
"version": "0.5.1",
"version": "0.5.2-patch.bin",
"description": "CLI utilities",
"definition": "",
"homepage": "https://github.com/absolunet/node-cli",
Expand Down

0 comments on commit 7d2ce61

Please sign in to comment.