Skip to content

Commit f31796a

Browse files
committed
feat(cli): add --help flag to display usage information
Closes #84
1 parent ea4de95 commit f31796a

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

packages/cli/index.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,41 @@ import languagePlugins = require('./lib/languagePlugins.js');
88

99
process.env.TSSLINT_CLI = '1';
1010

11+
if (process.argv.includes('--help') || process.argv.includes('-h')) {
12+
console.log(`
13+
Usage: tsslint [options]
14+
15+
Options:
16+
--project <glob...> Lint TypeScript/JavaScript projects
17+
--vue-project <glob...> Lint Vue projects
18+
--vue-vine-project <glob...> Lint Vue Vine projects
19+
--mdx-project <glob...> Lint MDX projects
20+
--astro-project <glob...> Lint Astro projects
21+
--ts-macro-project <glob...> Lint TS Macro projects
22+
--filter <glob...> Filter files to lint
23+
--fix Apply automatic fixes
24+
--force Ignore cache
25+
-h, --help Show this help message
26+
27+
Examples:
28+
# Single project
29+
tsslint --project tsconfig.json
30+
31+
# Multiple projects with glob
32+
tsslint --project packages/*/tsconfig.json
33+
34+
# Multiple projects with brace expansion
35+
tsslint --project {tsconfig.json,packages/*/tsconfig.json}
36+
37+
# Mixed framework projects
38+
tsslint --project packages/*/tsconfig.json --vue-project apps/web/tsconfig.json
39+
40+
# With filter and fix
41+
tsslint --project tsconfig.json --filter "src/**/*.ts" --fix
42+
`);
43+
process.exit(0);
44+
}
45+
1146
const _reset = '\x1b[0m';
1247
const gray = (s: string) => '\x1b[90m' + s + _reset;
1348
const red = (s: string) => '\x1b[91m' + s + _reset;

0 commit comments

Comments
 (0)