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

cli: Restore -v option #2926

Merged
merged 2 commits into from
Jun 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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