repos.FindByName()
This commit is contained in:
parent
60695905e0
commit
8bf3997c81
18
common.go
18
common.go
|
@ -25,7 +25,23 @@ func (r *RepoList) Hide() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// better name: use this
|
// better name: use this
|
||||||
func (r *RepoList) FindRepoByName(path string) *RepoRow {
|
// matches by path or by name
|
||||||
|
func (r *RepoList) FindByName(name string) *RepoRow {
|
||||||
|
loop := r.ReposSortByName()
|
||||||
|
for loop.Scan() {
|
||||||
|
repo := loop.Repo()
|
||||||
|
if repo.GoPath() == name {
|
||||||
|
return repo
|
||||||
|
}
|
||||||
|
base := filepath.Base(repo.GoPath())
|
||||||
|
if base == name {
|
||||||
|
return repo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RepoList) FindByPath(path string) *RepoRow {
|
||||||
return r.FindRepo(path)
|
return r.FindRepo(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue