1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-26 05:37:18 +02:00
lazygit/pkg/gui/context/context.go
Jesse Duffield 1dd7307fde start moving commit panel handlers into controller
more

and more

move rebase commit refreshing into existing abstraction

and more

and more

WIP

and more

handling clicks

properly fix merge conflicts

update cheatsheet

lots more preparation to start moving things into controllers

WIP

better typing

expand on remotes controller

moving more code into controllers
2022-03-17 19:13:40 +11:00

99 lines
2.2 KiB
Go

package context
import "github.com/jesseduffield/lazygit/pkg/gui/types"
type ContextTree struct {
Status types.Context
Files types.IListContext
Submodules types.IListContext
Menu types.IListContext
Branches types.IListContext
Remotes types.IListContext
RemoteBranches types.IListContext
Tags types.IListContext
BranchCommits types.IListContext
CommitFiles types.IListContext
ReflogCommits types.IListContext
SubCommits types.IListContext
Stash types.IListContext
Suggestions types.IListContext
Normal types.Context
Staging types.Context
PatchBuilding types.Context
Merging types.Context
Credentials types.Context
Confirmation types.Context
CommitMessage types.Context
Search types.Context
CommandLog types.Context
}
func (tree ContextTree) InitialViewContextMap() map[string]types.Context {
return map[string]types.Context{
"status": tree.Status,
"files": tree.Files,
"branches": tree.Branches,
"commits": tree.BranchCommits,
"commitFiles": tree.CommitFiles,
"stash": tree.Stash,
"menu": tree.Menu,
"confirmation": tree.Confirmation,
"credentials": tree.Credentials,
"commitMessage": tree.CommitMessage,
"main": tree.Normal,
"secondary": tree.Normal,
"extras": tree.CommandLog,
}
}
type TabContext struct {
Tab string
Contexts []types.Context
}
func (tree ContextTree) InitialViewTabContextMap() map[string][]TabContext {
return map[string][]TabContext{
"branches": {
{
Tab: "Local Branches",
Contexts: []types.Context{tree.Branches},
},
{
Tab: "Remotes",
Contexts: []types.Context{
tree.Remotes,
tree.RemoteBranches,
},
},
{
Tab: "Tags",
Contexts: []types.Context{tree.Tags},
},
},
"commits": {
{
Tab: "Commits",
Contexts: []types.Context{tree.BranchCommits},
},
{
Tab: "Reflog",
Contexts: []types.Context{
tree.ReflogCommits,
},
},
},
"files": {
{
Tab: "Files",
Contexts: []types.Context{tree.Files},
},
{
Tab: "Submodules",
Contexts: []types.Context{
tree.Submodules,
},
},
},
}
}