repolist/common.go

101 lines
1.7 KiB
Go

package repolist
import (
"go.wit.com/lib/gui/repostatus"
)
func (r *RepoList) Hidden() bool {
return r.reposbox.Hidden()
}
func (r *RepoList) Show() {
r.reposbox.Show()
}
func (r *RepoList) Hide() {
r.reposbox.Hide()
}
func (r *RepoList) AllRepos() []*Repo {
var all []*Repo
for _, repo := range me.allrepos {
all = append(all, repo)
}
return all
}
// deprecate this
func AllRepos() []*Repo {
var all []*Repo
for _, repo := range me.allrepos {
all = append(all, repo)
}
return all
}
// a human readable state of the current repo
func (r *Repo) State() string {
return r.dirtyLabel.String()
}
func (r *Repo) Scan() bool {
return r.NewScan()
}
// returns a name for human consuption only
// todo: implement nicknames
func (rs *Repo) Name() string {
if rs.Status.IsGoLang() {
return rs.Status.GoPath()
}
return rs.Status.Path()
}
func (r *Repo) Exists(s string) bool {
return false
}
func (r *Repo) GoPath() string {
return r.Status.GoPath()
}
func (r *Repo) CheckDirty() bool {
return r.Status.CheckDirty()
}
func (r *Repo) IsDirty() bool {
return r.Status.IsDirty()
}
func (r *Repo) ReadOnly() bool {
return r.Status.ReadOnly()
}
func (r *Repo) IsPerfect() bool {
if r.dirtyLabel.String() == "PERFECT" {
return true
}
if r.dirtyLabel.String() == "unchanged" {
return true
}
return false
}
func (r *Repo) RunCmd(cmd []string) (error, string) {
return r.Status.RunCmd(cmd)
}
func (r *Repo) AllTags() []*repostatus.Tag {
return r.Status.Tags.ListAll()
}
func (r *Repo) TagsBox() *repostatus.GitTagBox {
return r.Status.Tags
}
// todo, fix bool return for deletetag()
func (r *Repo) DeleteTag(t *repostatus.Tag) bool {
r.Status.DeleteTag(t)
return true
}