Skip to content

Commit 1e6587d

Browse files
docs: update readme to include CLI (#32)
* docs: update readme to include CLI * docs: fix readme to adjust to change requests --------- Co-authored-by: Martin C <[email protected]>
1 parent 8761e42 commit 1e6587d

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,77 @@ jobs:
8383
| 1 | **exit_code** | Integer | The exit code of the commitlint step. |
8484
| 2 | **status** | String | The outcome of the commitlint step. Possible values: 'success' or 'failure'. |
8585
86+
87+
## CLI (Command Line Interface)
88+
89+
### Installation
90+
91+
```shell
92+
pip install commitlint
93+
```
94+
95+
### Usage
96+
```
97+
$ commitlint --help
98+
usage: commitlint [-h] [-V] [--file FILE] [--hash HASH] [--from-hash FROM_HASH] [--to-hash TO_HASH] [--skip-detail] [commit_message]
99+
100+
Check if a commit message follows the conventional commit format.
101+
102+
positional arguments:
103+
commit_message The commit message to be checked.
104+
105+
optional arguments:
106+
-h, --help show this help message and exit
107+
-V, --version show program's version number and exit
108+
--file FILE Path to a file containing the commit message.
109+
--hash HASH Commit hash
110+
--from-hash FROM_HASH
111+
From commit hash
112+
--to-hash TO_HASH To commit hash
113+
--skip-detail Skip the detailed error message check
114+
```
115+
116+
### Examples
117+
Check commit message directly:
118+
119+
```shell
120+
$ commitlint "chore: my commit message"
121+
```
122+
123+
Check commit message from file:
124+
125+
```shell
126+
$ commitlint --file /foo/bar/commit-message.txt
127+
```
128+
129+
Check commit message of a hash:
130+
131+
```shell
132+
$ commitlint --hash 9a8c08173
133+
```
134+
135+
Check commit message of a hash range:
136+
137+
```shell
138+
$ commitlint --from-hash 00bf73fef7 --to-hash d6301f1eb0
139+
```
140+
141+
Check commit message skipping the detail check:
142+
143+
```shell
144+
$ commitlint --skip-detail "chore: my commit message"
145+
# or
146+
$ commitlint --skip-detail --hash 9a8c08173
147+
```
148+
149+
Version check:
150+
151+
```shell
152+
$ commitlint --version
153+
# or
154+
$ commitlint -V
155+
```
156+
86157
## Contribution
87158

88159
We appreciate feedback and contribution to this package. To get started please see our [contribution guide](./CONTRIBUTING.md).

0 commit comments

Comments
 (0)