@@ -51,6 +51,8 @@ type model struct {
51
51
// the width of the terminal; needed for instantiating components
52
52
// width int
53
53
choice chan string
54
+ // any body stashed during the initial parse of command-line --message args
55
+ remainingBody string
54
56
}
55
57
56
58
// returns whether the minimum requirements for a conventional commit are met.
@@ -73,17 +75,26 @@ func (m model) contextValue() string {
73
75
result .WriteString (": " )
74
76
return result .String ()
75
77
}
78
+ func (m model ) descriptionValue () string {
79
+ return m .commit [shortDescriptionIndex ]
80
+ }
81
+ func (m model ) breakingChangeValue () string {
82
+ return m .commit [breakingChangeIndex ]
83
+ }
76
84
77
85
// Returns a pretty-printed CC string. The model should be `.ready()` before you call `.value()`.
78
86
func (m model ) value () string {
79
87
result := strings.Builder {}
80
88
result .WriteString (m .contextValue ())
81
- result .WriteString (m .commit [ shortDescriptionIndex ] )
89
+ result .WriteString (m .descriptionValue () )
82
90
result .WriteString ("\n " )
83
- breakingChange := m .commit [breakingChangeIndex ]
84
- if breakingChange != "" {
85
- result .WriteString (fmt .Sprintf ("\n \n BREAKING CHANGE: %s\n " , breakingChange ))
91
+ if m .remainingBody != "" {
92
+ result .WriteString (m .remainingBody )
93
+ result .WriteString ("\n " )
94
+ }
95
+ if breakingChange := m .breakingChangeValue (); breakingChange != "" {
86
96
// TODO: handle multiple breaking change footers(?)
97
+ result .WriteString (fmt .Sprintf ("\n \n BREAKING CHANGE: %s\n " , breakingChange ))
87
98
}
88
99
return result .String ()
89
100
}
@@ -134,6 +145,7 @@ func initialModel(choice chan string, cc *parser.CC, cfg *config.Cfg) model {
134
145
descriptionInput : descModel ,
135
146
breakingChangeInput : bcModel ,
136
147
viewing : commitTypeIndex ,
148
+ remainingBody : cc .Body ,
137
149
}
138
150
if m .shouldSkip (m .viewing ) {
139
151
m = m .submit ().advance ()
0 commit comments