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

Commit

Permalink
Restore support for --version flag (#2859)
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya authored Jun 1, 2017
1 parent 1d8d928 commit 46c9376
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/tslint-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import commander = require("commander");
import * as fs from "fs";

import { VERSION } from "./linter";
import { run } from "./runner";
import { dedent } from "./utils";

Expand Down Expand Up @@ -187,10 +188,7 @@ const options: Option[] = [
},
];

function collect(val: string, memo: string[]) {
memo.push(val);
return memo;
}
commander.version(VERSION);

for (const option of options) {
const commanderStr = optionUsageTag(option) + optionParam(option);
Expand Down Expand Up @@ -253,7 +251,10 @@ run({
rulesDirectory: argv.rulesDir,
test: argv.test,
typeCheck: argv.typeCheck,
}, { log, error(m) { console.error(m); } }).then(process.exit);
}, {
log,
error: (m) => console.error(m),
}).then(process.exit);

function optionUsageTag({short, name}: Option) {
return short !== undefined ? `-${short}, --${name}` : `--${name}`;
Expand All @@ -269,3 +270,7 @@ function optionParam(option: Option) {
return "";
}
}
function collect(val: string, memo: string[]) {
memo.push(val);
return memo;
}

0 comments on commit 46c9376

Please sign in to comment.