Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
cli: Restore -v option (#2926)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajafff authored and adidahiya committed Jun 15, 2017
1 parent 43c56dd commit 1ec0bac
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/tslint-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,24 @@ const options: Option[] = [
},
];

commander.version(VERSION);
const builtinOptions: Option[] = [
{
short: "v",
name: "version",
type: "boolean",
describe: "current version",
description: "The current version of tslint.",
},
{
short: "h",
name: "help",
type: "boolean",
describe: "display detailed help",
description: "Prints this help message.",
},
];

commander.version(VERSION, "-v, --version");

for (const option of options) {
const commanderStr = optionUsageTag(option) + optionParam(option);
Expand All @@ -201,7 +218,7 @@ for (const option of options) {

commander.on("--help", () => {
const indent = "\n ";
const optionDetails = options.map((o) =>
const optionDetails = options.concat(builtinOptions).map((o) =>
`${optionUsageTag(o)}:${o.description.startsWith("\n") ? o.description.replace(/\n/g, indent) : indent + o.description}`);
console.log(`tslint accepts the following commandline options:\n\n ${optionDetails.join("\n\n ")}\n\n`);
});
Expand Down

0 comments on commit 1ec0bac

Please sign in to comment.