summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context/context.go
blob: 30030990f8795de62077e8b106241ab7d749aed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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           *TagsContext
	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,
				},
			},
		},
	}
}