1package operations
2
3import (
4 "github.com/MichaelMure/git-bug/bug"
5)
6
7// SetTitleOperation will change the title of a bug
8
9var _ bug.Operation = SetTitleOperation{}
10
11type SetTitleOperation struct {
12 bug.OpBase
13 Title string
14}
15
16func NewSetTitleOp(author bug.Person, title string) SetTitleOperation {
17 return SetTitleOperation{
18 OpBase: bug.NewOpBase(bug.SetTitleOp, author),
19 Title: title,
20 }
21}
22
23func (op SetTitleOperation) Apply(snapshot bug.Snapshot) bug.Snapshot {
24 snapshot.Title = op.Title
25
26 return snapshot
27}
28
29func SetTitle(b *bug.Bug, author bug.Person, title string) {
30 setTitleOp := NewSetTitleOp(author, title)
31 b.Append(setTitleOp)
32}