1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
lazygit/pkg/gui/context/dynamic_title_builder.go
2022-03-26 18:00:46 +11:00

24 lines
479 B
Go

package context
import "fmt"
type DynamicTitleBuilder struct {
formatStr string // e.g. 'remote branches for %s'
titleRef string // e.g. 'origin'
}
func NewDynamicTitleBuilder(formatStr string) *DynamicTitleBuilder {
return &DynamicTitleBuilder{
formatStr: formatStr,
}
}
func (self *DynamicTitleBuilder) SetTitleRef(titleRef string) {
self.titleRef = titleRef
}
func (self *DynamicTitleBuilder) Title() string {
return fmt.Sprintf(self.formatStr, self.titleRef)
}