diff --git a/src/tslint-cli.ts b/src/tslint-cli.ts index c9bf6a1e492..c14551c82a0 100644 --- a/src/tslint-cli.ts +++ b/src/tslint-cli.ts @@ -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"; @@ -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); @@ -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}`; @@ -269,3 +270,7 @@ function optionParam(option: Option) { return ""; } } +function collect(val: string, memo: string[]) { + memo.push(val); + return memo; +}