Skip to content

Commit

Permalink
🐛 Fix: commit 时使用中文报错 (#8)
Browse files Browse the repository at this point in the history
Co-authored-by: Ju4tCode <[email protected]>
  • Loading branch information
AzideCupric and yanyongyu authored Mar 21, 2023
1 parent 7833fd4 commit 6fadcf1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
poetry add nonemoji --dev
```

## pre-commit 使用
## pre-commit 中使用

```yaml
# .pre-commit-config.yaml
Expand All @@ -27,7 +27,24 @@ repos:
stages: [commit]

- repo: https://github.com/nonebot/nonemoji
rev: v0.1.1
rev: v0.1.3
hooks:
- id: nonemoji
stages: [pre-commit-msg]
```
## 使用
### 快速提交
使用如下命令,选择一个 emoji 并填写提交信息:
```bash
nonemoji commit
```

### 交互式使用

```bash
nonemoji
```
4 changes: 2 additions & 2 deletions nonemoji/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ def handle_no_subcommand(**_):

def handle_hook(commit_msg_file: str, **_):
file = Path(commit_msg_file)
original_msg = file.read_text()
original_msg = file.read_text(encoding="utf-8")
new_msg = prompt(original_msg)
file.write_text(new_msg)
file.write_text(new_msg, encoding="utf-8")


def handle_commit(
Expand Down

0 comments on commit 6fadcf1

Please sign in to comment.