1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Show all submodules recursively

This commit is contained in:
Stefan Haller
2024-02-04 22:42:58 +01:00
parent db4f12929e
commit 3b723282cb
13 changed files with 260 additions and 21 deletions

View File

@ -1,13 +1,33 @@
package models
import "path/filepath"
type SubmoduleConfig struct {
Name string
Path string
Url string
ParentModule *SubmoduleConfig // nil if top-level
}
func (r *SubmoduleConfig) FullName() string {
if r.ParentModule != nil {
return r.ParentModule.FullName() + "/" + r.Name
}
return r.Name
}
func (r *SubmoduleConfig) FullPath() string {
if r.ParentModule != nil {
return r.ParentModule.FullPath() + "/" + r.Path
}
return r.Path
}
func (r *SubmoduleConfig) RefName() string {
return r.Name
return r.FullName()
}
func (r *SubmoduleConfig) ID() string {
@ -17,3 +37,12 @@ func (r *SubmoduleConfig) ID() string {
func (r *SubmoduleConfig) Description() string {
return r.RefName()
}
func (r *SubmoduleConfig) GitDirPath(repoGitDirPath string) string {
parentPath := repoGitDirPath
if r.ParentModule != nil {
parentPath = r.ParentModule.GitDirPath(repoGitDirPath)
}
return filepath.Join(parentPath, "modules", r.Name)
}