1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
lazygit/pkg/gui/filetree/collapsed_paths.go

21 lines
416 B
Go
Raw Normal View History

2021-03-31 13:08:55 +02:00
package filetree
type CollapsedPaths map[string]bool
func (cp CollapsedPaths) ExpandToPath(path string) {
// need every directory along the way
2021-04-08 13:24:49 +02:00
splitPath := split(path)
for i := range splitPath {
dir := join(splitPath[0 : i+1])
2021-03-31 13:08:55 +02:00
cp[dir] = false
}
}
func (cp CollapsedPaths) IsCollapsed(path string) bool {
return cp[path]
}
func (cp CollapsedPaths) ToggleCollapsed(path string) {
cp[path] = !cp[path]
}