forked from commitizen-tools/commitizen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfactory.py
More file actions
19 lines (17 loc) · 639 Bytes
/
Copy pathfactory.py
File metadata and controls
19 lines (17 loc) · 639 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from commitizen import BaseCommitizen
from commitizen.config import BaseConfig
from commitizen.cz import registry
from commitizen.exceptions import NoCommitizenFoundException
def commiter_factory(config: BaseConfig) -> BaseCommitizen:
"""Return the correct commitizen existing in the registry."""
name: str = config.settings["name"]
try:
_cz = registry[name](config)
except KeyError:
msg_error = (
"The committer has not been found in the system.\n\n"
f"Try running 'pip install {name}'\n"
)
raise NoCommitizenFoundException(msg_error)
else:
return _cz