|
13 | 13 | from commitizen import factory, git, out |
14 | 14 | from commitizen.config import BaseConfig |
15 | 15 | from commitizen.cz.exceptions import CzException |
16 | | -from commitizen.cz.utils import get_backup_file_path, get_input_with_continuation |
| 16 | +from commitizen.cz.utils import get_backup_file_path |
17 | 17 | from commitizen.exceptions import ( |
18 | 18 | CommitError, |
19 | 19 | CommitMessageLengthExceededError, |
@@ -82,14 +82,20 @@ def _prompt_commit_questions(self) -> str: |
82 | 82 | if isinstance(root_err, CzException): |
83 | 83 | raise CustomError(root_err.__str__()) |
84 | 84 | raise err |
85 | | - elif question["type"] == "input" and question.get("continuation", False): |
86 | | - print(f"\033[90m💡 Type backslash and press Enter for line continuation\033[0m") |
87 | | - raw_answer = get_input_with_continuation(question["message"]) |
88 | | - if "filter" in question: |
89 | | - processed_answer = question["filter"](raw_answer) |
90 | | - else: |
91 | | - processed_answer = raw_answer |
92 | | - answers[question["name"]] = processed_answer |
| 85 | + elif question["type"] == "input" and question.get("multiline", False): |
| 86 | + print(f"\033[90m💡 Multiline input:\n Press Enter for new lines and Esc+Enter to finish\033[0m \n \033[90mor (Finish with 'Alt+Enter' or 'Esc then Enter')\033[0m") |
| 87 | + multiline_question = question.copy() |
| 88 | + multiline_question["multiline"] = True |
| 89 | + try: |
| 90 | + answer = questionary.prompt([multiline_question], style=cz.style) |
| 91 | + if not answer: |
| 92 | + raise NoAnswersError() |
| 93 | + answers.update(answer) |
| 94 | + except ValueError as err: |
| 95 | + root_err = err.__context__ |
| 96 | + if isinstance(root_err, CzException): |
| 97 | + raise CustomError(root_err.__str__()) |
| 98 | + raise err |
93 | 99 | else: |
94 | 100 | try: |
95 | 101 | answer = questionary.prompt([question], style=cz.style) |
|
0 commit comments