diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-16 14:46:53 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | 1dd7307fde033dae5fececac15810a99e26c3d91 (patch) | |
tree | 4e851c9e3229a6fe3b4191f6311d05d7a9142960 /pkg/gui/context | |
parent | a90b6efded49abcfa2516db794d7875b0396f558 (diff) |
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
Diffstat (limited to 'pkg/gui/context')
-rw-r--r-- | pkg/gui/context/context.go | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/pkg/gui/context/context.go b/pkg/gui/context/context.go new file mode 100644 index 000000000..67de237ed --- /dev/null +++ b/pkg/gui/context/context.go @@ -0,0 +1,98 @@ +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, + }, + }, + }, + } +} |