Skip to content

Commit a3e8374

Browse files
committed
docs(docs): 更新使用文档
1 parent 8492e3a commit a3e8374

File tree

1 file changed

+61
-1
lines changed

1 file changed

+61
-1
lines changed

README.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,66 @@ npm i -g code-genius
2525
| cup | --ignore <match> | 清理运行时生成的文件 |
2626
| ihooks | -- | 使用且有修改 git-simple-hooks 后需要重新初始化 |
2727

28+
## 编程方式
29+
30+
| API | 参数 | 返回 |
31+
| ----------------------------------- | -------------------------------------------------------------------------------------- | --------------- |
32+
| `gitCommit(types, scopes, options)` | `types: Array<CommitType>`, `scopes: Array<CommitScope>`, `options: GitCommitOptions)` | `Promise<void>` |
33+
34+
```typescript
35+
// ./index.ts
36+
import { gitCommit, gitCommitScopes, gitCommitTypes } from "code-genius";
37+
38+
gitCommit(gitCommitTypes, gitCommitScopes, { enableEmoji: true });
39+
40+
// 运行
41+
npx esno index.ts
42+
```
43+
44+
2. `gitCommitVerify: () => Promise<void>`
45+
46+
| API | 参数 | 返回 |
47+
| ------------------- | ---- | --------------- |
48+
| `gitCommitVerify()` | `--` | `Promise<void>` |
49+
50+
```typescript
51+
// ./index.ts
52+
import { gitCommitVerify } from "code-genius";
53+
54+
gitCommitVerify();
55+
56+
// 运行
57+
npx esno index.ts
58+
```
59+
60+
| API | 参数 | 返回 |
61+
| ---------------- | ----------------- | --------------- |
62+
| `cleanUp(paths)` | `paths: string[]` | `Promise<void>` |
63+
64+
```typescript
65+
// ./index.ts
66+
import { cleanUp, cleanUpDirs } from "code-genius";
67+
68+
cleanUp(cleanUpDirs);
69+
70+
// 运行
71+
npx esno index.ts
72+
```
73+
74+
| API | 参数 | 返回 |
75+
| ------------------------- | -------------- | --------------- |
76+
| `gitInitSimpleHooks(cwd)` | `cwd?: string` | `Promise<void>` |
77+
78+
```typescript
79+
// ./index.ts
80+
import { gitInitSimpleHooks, cwd } from "code-genius";
81+
82+
gitInitSimpleHooks(cwd);
83+
84+
// 运行
85+
npx esno index.ts
86+
```
87+
2888
## 执照
2989

3090
MIT License
@@ -47,4 +107,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
47107
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
48108
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
49109
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
50-
SOFTWARE.
110+
SOFTWARE.

0 commit comments

Comments
 (0)