Skip to content

Commit eb99cff

Browse files
committed
docs: add string variant of .edit
1 parent c881433 commit eb99cff

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

docs/reference-api.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,12 @@ load({parserPreset: './parser-preset.js'})
213213

214214
```ts
215215
type Range = {
216+
/* Lower end of the commit range to read */
216217
from: string;
218+
/* Upper end of the commit range to read */
217219
to: string;
218-
edit?: boolean;
220+
/* Wether (boolean) to read from ./.git/COMMIT_EDITMSG or where to read from (string) */
221+
edit?: boolean | string;
219222
};
220223

221224
read(range: Range) => Promise<string[]>
@@ -231,6 +234,10 @@ read({edit: true})
231234
.then(messages => console.log(messages));
232235
// => ['I did something\n\n']
233236

237+
read({edit: './git/GITGUI_EDITMESSAGE'})
238+
.then(messages => console.log(messages));
239+
// => ['I did something via git gui\n\n']
240+
234241
read({from: 'HEAD~2'})
235242
.then(messages => console.log(messages));
236243
// => ['I did something\n\n', 'Initial commit\n\n']

docs/reference-cli.md

+11-17
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
# CLI
22

3-
## Installation
4-
53
```bash
6-
npm install --save-dev @commitlint/cli
7-
```
4+
❯ npx commitlint --help
85

9-
## Usage
10-
11-
```bash
12-
❯ commitlint --help
13-
commitlint - Lint commit messages
6+
[email protected] - Lint your commit messages
147

15-
[input] reads from stdin if --edit, --from, --to are omitted
16-
--color, -c toggle formatted output, defaults to: true
17-
--edit, -e read last commit message found in ./.git/COMMIT_EDITMSG
18-
--extends, -x array of resolvable ids pointing to shareable configurations to extend
19-
--from, -f lower end of the commit range to lint; applies if edit=false
20-
--to, -t upper end of the commit range to lint; applies if edit=false
21-
--quiet, -q toggle console output
22-
--parser-preset, -p resolvable id to load and pass to conventional-commits-parser
8+
[input] reads from stdin if --edit, --from and --to are omitted
9+
--color, -c toggle colored output, defaults to: true
10+
--cwd, -d directory to execute in, defaults to: /Users/marneb/Documents/oss/commitlint
11+
--edit, -e read last commit message from the specified file or fallbacks to ./.git/COMMIT_EDITMSG
12+
--extends, -x array of shareable configurations to extend
13+
--from, -f lower end of the commit range to lint; applies if edit=false
14+
--to, -t upper end of the commit range to lint; applies if edit=false
15+
--quiet, -q toggle console output
16+
--parser-preset, -p configuration preset to use for conventional-commits-parser
2317
```

0 commit comments

Comments
 (0)