-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommit.go
85 lines (68 loc) · 1.53 KB
/
commit.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package parser
// Commit represents a commit that adheres to the conventional commits specification
type Commit struct {
message string
header string
body string
footer string
commitType string
scope string
description string
notes []Note
isBreakingChange bool
}
// Message returns input commit message
func (c *Commit) Message() string {
return c.message
}
// Header returns header of the commit
func (c *Commit) Header() string {
return c.header
}
// Body returns body of the commit
func (c *Commit) Body() string {
return c.body
}
// Footer returns footer of the commit
func (c *Commit) Footer() string {
return c.footer
}
// Type returns type of the commit
func (c *Commit) Type() string {
return c.commitType
}
// Scope returns scope of the commit
func (c *Commit) Scope() string {
return c.scope
}
// Description returns description of the commit
func (c *Commit) Description() string {
return c.description
}
// Notes returns footer notes of the commit
func (c *Commit) Notes() []Note {
return c.notes
}
// IsBreakingChange returns true if commit is breaking change
func (c *Commit) IsBreakingChange() bool {
return c.isBreakingChange
}
// Note represents one footer note
type Note struct {
token string
value string
}
func newNote(token, value string) Note {
return Note{
token: token,
value: value,
}
}
// Token returns the token of the Footer Note
func (n *Note) Token() string {
return n.token
}
// Value returns the value of the Footer Note
func (n *Note) Value() string {
return n.value
}