8000 docs(README): added about, installation, creating, etc · ranshamay/commitizen@c96c4bc · GitHub
[go: up one dir, main page]

Skip to content

Commit c96c4bc

Browse files
committed
docs(README): added about, installation, creating, etc
1 parent 59bf578 commit c96c4bc

File tree

1 file changed

+137
-1
lines changed

1 file changed

+137
-1
lines changed

README.rst

Lines changed: 137 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,143 @@
1+
=============
12
Commitizen
23
=============
34

4-
> Python command line utility to standardize commit messages
5+
::
6+
7+
Python 3 command line utility to standardize commit messages
8+
9+
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square)](https://conventionalcommits.org)
510

611

12+
About
13+
=======
14+
15+
This client tool prompts the user with information about the commit.
16+
717
Based on `conventional commits <https://conventionalcommits.org/>`_
18+
19+
By default it uses `angular guidelines <https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit>`_
20+
21+
22+
Installation
23+
=============
24+
25+
pip install commitizen
26+
27+
28+
Usage
29+
======
30+
31+
Run in your terminal
32+
33+
cz
34+
35+
Help
36+
=====
37+
38+
39+
cz --help
40+
41+
Creating a commiter
42+
========================
43+
44+
Create a file starting with :code:`cz_` for example :code:`cz_jira.py`.
45+
This prefix is used to detect the plugin. Same method `flask uses <http://flask.pocoo.org/docs/0.12/extensiondev/>`_
46+
47+
Inherit from :code:`BaseCommitizen` and you must define :code:`questions`
48+
and :code:`message`. The others are optionals.
49+
50+
51+
.. code-block:: python
52+
53+
from commitizen import BaseCommitizen
54+
55+
class JiraCz(BaseCommitizen):
56+
57+
def questions(self):
58+
"""Questions regarding the commit message.
59+
60+
Must have 'whaaaaat' format.
61+
More info: https://github.com/finklabs/whaaaaat/
62+
63+
:rtype: list
64+
"""
65+
questions = [
66+
{
67+
'type': 'input',
68+
'name': 'title',
69+
'message': 'Commit title'
70+
},
71+
{
72+
'type': 'input',
73+
'name': 'issue',
74+
'message': 'Jira Issue number:'
75+
},
76+
]
77+
return questions
78+
79+
def message(self, answers):
80+
"""Generate the message with the given answers.
81+
82+
:type answers: dict
83+
:rtype: string
84+
"""
85+
return '{0} (#{1})'.format(answers['title'], answers['issue'])
86+
87+
def example(self):
88+
"""Provide an example to help understand the style (OPTIONAL)
89+
Used by cz example.
90+
91+
:rtype: string
92+
"""
93+
return 'Problem with user (#321)'
94+
95+
def schema(self):
96+
"""Show the schema used (OPTIONAL)
97+
98+
:rtype: string
99+
"""
100+
return '<title> (<issue>)'
101+
102+
def info(self):
103+
"""Explanation of the commit rules. (OPTIONAL)
104+
:rtype: string
105+
"""
106+
return 'We use this because is useful'
107+
108+
109+
discover_this = JiraCz # used by the plugin system
110+
111+
112+
The next file required is :code:`setup.py` modified from flask version
113+
114+
.. code-block:: python
115+
116+
from distutils.core import setup
117+
118+
setup(
119+
name='JiraCommitizen',
120+
version='0.1.0',
121+
py_modules=['cz_jira'],
122+
license='MIT',
123+
long_description='this is a long description',
124+
install_requires=['commitizen']
125+
)
126+
127+
So at the end we would have
128+
129+
.. code-block::
130+
131+
.
132+
├── cz_jira.py
133+
└── setup.py
134+
135+
And that's it, you can install it without uploading by doing
136+
:code:`pip install .`
137+
138+
139+
Todo
140+
====
141+
142+
- [ ] auto changelog integration
143+
- [ ] tests

0 commit comments

Comments
 (0)
0