2024-02-25 13:09:56 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"go.wit.com/lib/gui/repolist"
|
|
|
|
)
|
|
|
|
|
|
|
|
// like tcl/tk, use ENV variables to set display preferences
|
|
|
|
func hideFunction(r *repolist.RepoRow) {
|
|
|
|
// always show dirty repos
|
|
|
|
if r.Status.IsDirty() {
|
|
|
|
r.Show()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// hide read-only repos
|
|
|
|
if os.Getenv("AUTOTYPIST_READONLY") == "hide" {
|
|
|
|
if r.Status.ReadOnly() {
|
2024-02-26 11:08:28 -06:00
|
|
|
// log.Info(r.Name(), "hiding read-only repo")
|
2024-02-25 13:09:56 -06:00
|
|
|
r.Hide()
|
|
|
|
return
|
2024-02-25 18:37:03 -06:00
|
|
|
} else {
|
2024-02-26 11:08:28 -06:00
|
|
|
// log.Info(r.Name(), "not hiding read-only repo")
|
2024-02-25 13:09:56 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// show repos with mismatched mode
|
|
|
|
// this means, if you are in "devel" mode, show all the repos that
|
|
|
|
// might be stuck on the wrong branch, like 'master' or '<username>'
|
|
|
|
if os.Getenv("AUTOTYPIST_MODE") != "" {
|
|
|
|
if !r.Status.IsCorrectMode(os.Getenv("AUTOTYPIST_MODE")) {
|
|
|
|
r.Show()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// hide perfectly clean repos
|
|
|
|
if os.Getenv("AUTOTYPIST_CLEAN") == "hide" {
|
|
|
|
if r.IsPerfect() {
|
|
|
|
r.Hide()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// show everything else. often this will be "unconforming" repos
|
|
|
|
// if you what those repos ignored, add these to the config file
|
|
|
|
// as read-only=true
|
|
|
|
r.Show()
|
|
|
|
}
|