summaryrefslogtreecommitdiff
path: root/hideFunction.go
blob: a9f835b217fc002f78d9ad70b72fd52e0c2001eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package main

import (
	"os"

	"go.wit.com/lib/gui/repolist"
	"go.wit.com/log"
)

// like tcl/tk, use ENV variables to set display preferences
func hideFunction(r *repolist.RepoRow) {
	if r.GoPath() == "go.wit.com/dev/alexflint/arg" {
		log.Info("found autoHideReleased() =", me.autoHideReleased.Checked())
		log.Info("found alexflint/arg IsReleased() =", r.Status.IsReleased())
	}

	// always show dirty repos
	if r.Status.IsDirty() {
		r.Show()
		return
	}

	// always show repos that have not been merged ?
	if r.GoState() == "merge to devel" {
		r.Show()
		return
	}

	// hide read-only repos
	if os.Getenv("AUTOTYPIST_READONLY") == "hide" {
		if r.Status.ReadOnly() {
			// log.Info(r.Name(), "hiding read-only repo")
			r.Hide()
			return
		} else {
			// log.Info(r.Name(), "not hiding read-only repo")
		}
	}

	// 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
		}
	}

	if me.autoHideReleased.Checked() {
		if r.Status.IsReleased() {
			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()
}

/*
func showHideRepos(repo *repolist.RepoRow) {
	if repo.GoPath() == "go.wit.com/dev/alexflint/arg" {
		log.Info("found autoHideReleased() =", me.autoHideReleased.Checked())
		log.Info("found alexflint/arg IsReleased() =", repo.Status.IsReleased())
	}

	if me.autoHideReleased.Checked() {
		if repo.Status.IsReleased() {
			repo.Hide()
			return
		}
	}
	repo.Show()
}
*/