starting to go down map route

This commit is contained in:
2023-02-23 08:35:11 -08:00
parent 7296409a49
commit 17f056ceb9

View File

@@ -50,11 +50,12 @@ type (
}
SettingsCursor int
Settings struct {
AllAuthors []string
AllAuthors map[string]bool
SelectedAuthors []string
AllRepos []string
AllRepos map[string]bool
SelectedRepos []string
cursor SettingsCursor
highlightedEntry int
AuthorList list.Model
RepoList list.Model
}
@@ -290,15 +291,25 @@ func NewSettings() (Settings, error) {
var m Settings
var err error
m.cursor = authors
m.AllRepos, err = commits.GetMRRepos()
allRepos, err := commits.GetMRRepos()
if err != nil {
return m, err
}
m.SelectedRepos = m.AllRepos
m.AllAuthors, err = commits.RepoSet(m.AllRepos).GetRepoAuthors()
allAuthors, err := commits.RepoSet(allRepos).GetRepoAuthors()
if err != nil {
return m, err
}
m.AllRepos = make(map[string]bool)
for _, v := range allRepos {
m.AllRepos[v] = true
}
m.AllAuthors = make(map[string]bool)
for _, v := range allAuthors {
m.AllAuthors[v] = false
}
m.SelectedRepos = allRepos
email, _ := commits.GetAuthorEmail()
if email != "" {
m.SelectedAuthors = append(m.SelectedAuthors, email)
@@ -307,6 +318,9 @@ func NewSettings() (Settings, error) {
if name != "" {
m.SelectedAuthors = append(m.SelectedAuthors, name)
}
for _, v := range m.SelectedRepos {
m.AllAuthors[v] = true
}
return m, nil
}