You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(customize): add required field for input questions
Users can now mark a cz_customize input question as required by setting
required = true in their config. The loader converts this into a questionary
validate= callable that rejects empty/whitespace-only answers with the
message 'This answer is required.' The required key is stripped before the
question dict reaches questionary, so questionary never sees the unknown key.
Closes#1231
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/customization/config_file.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,7 @@ Example:
45
45
type = "input"
46
46
name = "message"
47
47
message = "Body."
48
+
required = true
48
49
49
50
[[tool.commitizen.customize.questions]]
50
51
type = "confirm"
@@ -181,6 +182,7 @@ Example:
181
182
|`default`|`Any`|`None`| (OPTIONAL) The default value for this question. |
182
183
|`filter`|`str`|`None`| (OPTIONAL) Validator for user's answer. **(Work in Progress)**|
183
184
|`multiline`|`bool`|`False`| (OPTIONAL) Enable multiline support when `type = input`. |
185
+
|`required`|`bool`|`False`| (OPTIONAL) When `true` and `type = input`, the user cannot submit an empty answer. An error message ("This answer is required.") is displayed until a non-blank value is entered. |
184
186
|`use_search_filter`|`bool`|`False`| (OPTIONAL) Enable search/filter functionality for list/select type questions. This allows users to type and filter through the choices. |
185
187
|`use_jk_keys`|`bool`|`True`| (OPTIONAL) Enable/disable j/k keys for navigation in list/select type questions. Set to false if you prefer arrow keys only. |
0 commit comments