Skip to content

Commit 4899bb2

Browse files
author
Ben Quarmby
committed
feat: support CLI options from JSON file or Common.js module
1 parent 24eee2d commit 4899bb2

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

@commitlint/cli/src/cli.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ test('should print help', async () => {
556556
-t, --to upper end of the commit range to lint; applies if edit=false [string]
557557
-V, --verbose enable verbose output for reports without problems [boolean]
558558
-s, --strict enable strict mode; result code 2 for warnings, 3 for errors [boolean]
559+
--options path to a JSON file or Common.js module containing CLI options
559560
-v, --version display version information [boolean]
560561
-h, --help Show help [boolean]"
561562
`);

@commitlint/cli/src/cli.ts

+5
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ const cli = yargs(process.argv.slice(2))
143143
.alias('v', 'version')
144144
.help('help')
145145
.alias('h', 'help')
146+
.config(
147+
'options',
148+
'path to a JSON file or Common.js module containing CLI options',
149+
require
150+
)
146151
.usage(`${pkg.name}@${pkg.version} - ${pkg.description}\n`)
147152
.usage(
148153
`[input] reads from stdin if --edit, --env, --from and --to are omitted`

docs/reference/cli.md

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Options:
3636
[boolean]
3737
-s, --strict enable strict mode; result code 2 for warnings, 3 for
3838
errors [boolean]
39+
--options path to a JSON file or Common.js module containing CLI
40+
options
3941
-v, --version display version information [boolean]
4042
-h, --help Show help [boolean]
4143
```

0 commit comments

Comments
 (0)