Skip to content

Commit cfec0f5

Browse files
zevisertLee-W
authored andcommitted
feat(prompt): add keyboard shortcuts with config option
1 parent 07ac1ea commit cfec0f5

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

commitizen/cz/conventional_commits/conventional_commits.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,55 +45,68 @@ def questions(self) -> List[Dict[str, Any]]:
4545
"type": "list",
4646
"name": "prefix",
4747
"message": "Select the type of change you are committing",
48+
"use_shortcuts": self.config.settings['use_shortcuts'],
4849
"choices": [
4950
{
5051
"value": "fix",
5152
"name": "fix: A bug fix. Correlates with PATCH in SemVer",
53+
"key": "x",
5254
},
5355
{
5456
"value": "feat",
5557
"name": "feat: A new feature. Correlates with MINOR in SemVer",
58+
"key": "f",
59+
},
60+
{
61+
"value": "docs",
62+
"name": "docs: Documentation only changes",
63+
"key": "d",
5664
},
57-
{"value": "docs", "name": "docs: Documentation only changes"},
5865
{
5966
"value": "style",
6067
"name": (
6168
"style: Changes that do not affect the "
6269
"meaning of the code (white-space, formatting,"
6370
" missing semi-colons, etc)"
6471
),
72+
"key": "s",
6573
},
6674
{
6775
"value": "refactor",
6876
"name": (
6977
"refactor: A code change that neither fixes "
7078
"a bug nor adds a feature"
7179
),
80+
"key": "r",
7281
},
7382
{
7483
"value": "perf",
7584
"name": "perf: A code change that improves performance",
85+
"key": "p",
7686
},
7787
{
7888
"value": "test",
7989
"name": (
8090
"test: Adding missing or correcting " "existing tests"
8191
),
92+
"key": "t",
8293
},
8394
{
8495
"value": "build",
8596
"name": (
8697
"build: Changes that affect the build system or "
8798
"external dependencies (example scopes: pip, docker, npm)"
8899
),
100+
"key": "b",
89101
},
90102
{
91103
"value": "ci",
92104
"name": (
93105
"ci: Changes to our CI configuration files and "
94106
"scripts (example scopes: GitLabCI)"
95107
),
96-
},
108+
"key": "c",
109+
}
97110
],
98111
},
99112
{

commitizen/defaults.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"changelog_incremental": False,
2222
"changelog_start_rev": None,
2323
"update_changelog_on_bump": False,
24+
"use_shortcuts": False,
2425
}
2526

2627
MAJOR = "MAJOR"

0 commit comments

Comments
 (0)