Skip to content

Commit

Permalink
feat: support CLI options from JSON file or Common.js module
Browse files Browse the repository at this point in the history
  • Loading branch information
benquarmby committed Aug 2, 2024
1 parent 9c7c3bf commit bc9bdcf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions @commitlint/cli/src/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ test('should print help', async () => {
-t, --to upper end of the commit range to lint; applies if edit=false [string]
-V, --verbose enable verbose output for reports without problems [boolean]
-s, --strict enable strict mode; result code 2 for warnings, 3 for errors [boolean]
--options path to a JSON file or Common.js module containing CLI options
-v, --version display version information [boolean]
-h, --help Show help [boolean]"
`);
Expand Down
5 changes: 5 additions & 0 deletions @commitlint/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ const cli = yargs(process.argv.slice(2))
.alias('v', 'version')
.help('help')
.alias('h', 'help')
.config(
'options',
'path to a JSON file or Common.js module containing CLI options',
require
)
.usage(`${pkg.name}@${pkg.version} - ${pkg.description}\n`)
.usage(
`[input] reads from stdin if --edit, --env, --from and --to are omitted`
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Options:
[boolean]
-s, --strict enable strict mode; result code 2 for warnings, 3 for
errors [boolean]
--options path to a JSON file or Common.js module containing CLI
options
-v, --version display version information [boolean]
-h, --help Show help [boolean]
```

0 comments on commit bc9bdcf

Please sign in to comment.