mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-11 11:42:12 +02:00
28 lines
703 B
Go
28 lines
703 B
Go
package presentation
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
|
"github.com/jesseduffield/lazygit/pkg/theme"
|
|
"github.com/samber/lo"
|
|
)
|
|
|
|
func GetSubmoduleListDisplayStrings(submodules []*models.SubmoduleConfig) [][]string {
|
|
return lo.Map(submodules, func(submodule *models.SubmoduleConfig, _ int) []string {
|
|
return getSubmoduleDisplayStrings(submodule)
|
|
})
|
|
}
|
|
|
|
func getSubmoduleDisplayStrings(s *models.SubmoduleConfig) []string {
|
|
name := s.Name
|
|
if s.ParentModule != nil {
|
|
indentation := ""
|
|
for p := s.ParentModule; p != nil; p = p.ParentModule {
|
|
indentation += " "
|
|
}
|
|
|
|
name = indentation + "- " + s.Name
|
|
}
|
|
|
|
return []string{theme.DefaultTextColor.Sprint(name)}
|
|
}
|