1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-14 11:23:09 +02:00
lazygit/pkg/gui/context/dynamic_title_builder.go

24 lines
479 B
Go
Raw Normal View History

2022-03-26 05:44:30 +02:00
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)
}