summaryrefslogtreecommitdiff
path: root/addRepo.go
diff options
context:
space:
mode:
Diffstat (limited to 'addRepo.go')
-rw-r--r--addRepo.go24
1 files changed, 13 insertions, 11 deletions
diff --git a/addRepo.go b/addRepo.go
index a437816..0d99c14 100644
--- a/addRepo.go
+++ b/addRepo.go
@@ -1,7 +1,7 @@
package repolist
import (
- "strings"
+ "errors"
"go.wit.com/gui"
"go.wit.com/lib/gui/repostatus"
@@ -44,32 +44,32 @@ func (r *Repo) Show() {
r.hidden = false
}
-func (r *RepoList) AddRepo(path string, master string, devel string, user string) *Repo {
+func (r *RepoList) AddRepo(path string, master string, devel string, user string) (error, *Repo) {
return r.addRepo(r.reposgrid, path, master, devel, user)
}
-func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel string, user string) *Repo {
- _, ok := r.allrepos[path]
+func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel string, user string) (error, *Repo) {
+ existingr, ok := r.allrepos[path]
if ok {
log.Info("addRepo() already had path", path)
- return nil
+ return nil, existingr
}
// log.Info("addRepo() attempting to add path", path)
- rstatus := repostatus.NewRepoStatusWindow(path)
+ err, rstatus := repostatus.NewRepoStatusWindow(path)
if rstatus == nil {
- // log.Info("path isn't a repo I can figure out yet", path)
+ log.Info("add failed. I can figure this out yet", path, err)
// probably this isn't downloaded
- return nil
+ return err, nil
}
newRepo := new(Repo)
newRepo.Status = rstatus
- path = strings.TrimSuffix(path, "/") // trim any extranous '/' chars put in the config file by the user
+ // path = strings.TrimSuffix(path, "/") // trim any extranous '/' chars put in the config file by the user
if path == "" {
// just an empty line in the config file
- return nil
+ return errors.New("you sent a blank path. stop being silly"), nil
}
newRepo.pLabel = grid.NewLabel(path).SetProgName("path")
@@ -82,6 +82,8 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
newRepo.endBox = grid.NewHorizontalBox("HBOX")
newRepo.endBox.NewButton("Configure", func() {
if newRepo.Status == nil {
+ // this should never happen, but it does happen because I'm not that smart and forget I can nil Status
+ // for some reason that makes sense in my head. again, I'm not that smart
log.Warn("status window wasn't created")
return
}
@@ -135,5 +137,5 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
grid.NextRow()
r.allrepos[path] = newRepo
- return newRepo
+ return nil, newRepo
}