Skip to content

Commit 4632319

Browse files
committed
update(sample script)
add write-commit script
1 parent 6b518ac commit 4632319

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

scripts/write-commit.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import sys
2+
import subprocess
3+
4+
commit_kinds = ["feat", "chore", "refactor", "update"]
5+
6+
kind = input("Commit kind? ").strip()
7+
8+
if kind not in commit_kinds:
9+
print(f"Invalid commit kind. Use one of: {', '.join(sorted(commit_kinds))}")
10+
sys.exit(1)
11+
12+
commit_title = input("Commit title? ").strip()
13+
commit_message = input("Commit message? ").strip()
14+
15+
message = f"""{kind}({commit_title})
16+
17+
{commit_message}
18+
"""
19+
20+
print(message)
21+
22+
subprocess.run(["git", "add", "."], check=True)
23+
subprocess.run(["git", "commit", "-m", message], check=True)

0 commit comments

Comments
 (0)