Skip to content

Commit

Permalink
src: Add -h and --help
Browse files Browse the repository at this point in the history
  • Loading branch information
Raynos authored and plantain-00 committed May 5, 2020
1 parent 3479efc commit 91f4ff1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ function showToolVersion() {
console.log(`Version: ${packageJson.version}`)
}

function printHelp() {
console.log(`type-coverage [options]
-p, --project string? tell the CLI where is the tsconfig.json
--detail boolean? show detail
--at-least number? fail if coverage rate < this value
--debug boolean? show debug info
--strict boolean? strict mode
--ignore-catch boolean? ignore catch
--cache boolean? enable cache
--ignore-files string[]? ignore files
`)
}

async function executeCommandLine() {
const argv = minimist(process.argv.slice(2), { '--': true }) as unknown as ParsedArgs

Expand All @@ -23,6 +37,11 @@ async function executeCommandLine() {
return
}

if (argv.h || argv.help) {
printHelp()
return process.exit(0)
}

suppressError = argv.suppressError

const { correctCount, totalCount, anys } = await lint(
Expand Down Expand Up @@ -52,6 +71,8 @@ async function executeCommandLine() {
interface ParsedArgs {
v: boolean
version: boolean
h: boolean
help: boolean
suppressError: boolean
p: string
project: string
Expand Down

0 comments on commit 91f4ff1

Please sign in to comment.