Skip to content

Commit 088e24f

Browse files
committed
feat(cz/cz_customize): implement info to support info and info_path
#54
1 parent 78aa985 commit 088e24f

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

commitizen/cz/customize/customize.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,12 @@ def schema(self) -> str:
3434
return self.custom_config.get("schema")
3535

3636
def info(self) -> str:
37-
# TODO
37+
info_path = self.custom_config.get("info_path")
38+
info = self.custom_config.get("info")
39+
if info_path:
40+
with open(info_path, "r") as f:
41+
content = f.read()
42+
return content
43+
elif info:
44+
return info
3845
raise NotImplementedError("Not Implemented yet")

tests/test_cz_customize.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def config():
1616
schema = "<type>: <body>"
1717
bump_pattern = "^(break|new|fix|hotfix)"
1818
bump_map = {"break" = "MAJOR", "new" = "MINOR", "fix" = "PATCH", "hotfix" = "PATCH"}
19+
info = "This is a customized cz."
1920
2021
[[tool.commitizen.customize.questions]]
2122
type = "list"
@@ -80,3 +81,8 @@ def test_example(config):
8081
def test_schema(config):
8182
cz = CustomizeCommitsCz(config)
8283
assert "<type>: <body>" in cz.schema()
84+
85+
86+
def test_info(config):
87+
cz = CustomizeCommitsCz(config)
88+
assert "This is a customized cz." in cz.info()

0 commit comments

Comments
 (0)