1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-29 23:17:32 +02:00
2022-12-27 21:35:36 +11:00

122 lines
2.3 KiB
Go

package components
import (
"fmt"
"github.com/jesseduffield/gocui"
)
type Views struct {
t *TestDriver
}
// not exporting this because I want the test to always be explicit about what
// view it's dealing with.
func (self *Views) current() *View {
return &View{
context: "current view",
getView: func() *gocui.View { return self.t.gui.CurrentContext().GetView() },
t: self.t,
}
}
func (self *Views) Main() *View {
return &View{
context: "main view",
getView: func() *gocui.View { return self.t.gui.MainView() },
t: self.t,
}
}
func (self *Views) Secondary() *View {
return &View{
context: "secondary view",
getView: func() *gocui.View { return self.t.gui.SecondaryView() },
t: self.t,
}
}
func (self *Views) ByName(viewName string) *View {
return &View{
context: fmt.Sprintf("%s view", viewName),
getView: func() *gocui.View { return self.t.gui.View(viewName) },
t: self.t,
}
}
func (self *Views) Commits() *View {
return self.ByName("commits")
}
func (self *Views) Files() *View {
return self.ByName("files")
}
func (self *Views) Status() *View {
return self.ByName("status")
}
func (self *Views) Submodules() *View {
return self.ByName("submodules")
}
func (self *Views) Information() *View {
return self.ByName("information")
}
func (self *Views) Branches() *View {
return self.ByName("localBranches")
}
func (self *Views) RemoteBranches() *View {
return self.ByName("remoteBranches")
}
func (self *Views) Tags() *View {
return self.ByName("tags")
}
func (self *Views) ReflogCommits() *View {
return self.ByName("reflogCommits")
}
func (self *Views) SubCommits() *View {
return self.ByName("subCommits")
}
func (self *Views) CommitFiles() *View {
return self.ByName("commitFiles")
}
func (self *Views) Stash() *View {
return self.ByName("stash")
}
func (self *Views) Staging() *View {
return self.ByName("staging")
}
func (self *Views) StagingSecondary() *View {
return self.ByName("stagingSecondary")
}
func (self *Views) Menu() *View {
return self.ByName("menu")
}
func (self *Views) Confirmation() *View {
return self.ByName("confirmation")
}
func (self *Views) CommitMessage() *View {
return self.ByName("commitMessage")
}
func (self *Views) Suggestions() *View {
return self.ByName("suggestions")
}
func (self *Views) MergeConflicts() *View {
return self.ByName("mergeConflicts")
}