79 lines
1.7 KiB
Go
79 lines
1.7 KiB
Go
// This is a simple example
|
|
package main
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"strings"
|
|
)
|
|
|
|
func (r *repo) String() string {
|
|
return r.status.String()
|
|
}
|
|
|
|
func (r *repo) getPath() string {
|
|
return r.path
|
|
}
|
|
|
|
func RemoveFirstElement(slice []string) (string, []string) {
|
|
if len(slice) == 0 {
|
|
return "", slice // Return the original slice if it's empty
|
|
}
|
|
return slice[0], slice[1:] // Return the slice without the first element
|
|
}
|
|
|
|
// returns path, master branch name, devel branch name, user branch name
|
|
func splitLine(line string) (string, string, string, string) {
|
|
var path, master, devel, user string
|
|
parts := strings.Split(line, " ")
|
|
path, parts = RemoveFirstElement(parts)
|
|
master, parts = RemoveFirstElement(parts)
|
|
devel, parts = RemoveFirstElement(parts)
|
|
user, parts = RemoveFirstElement(parts)
|
|
// path, master, devel, user := strings.Split(line, " ")
|
|
return path, master, devel, user
|
|
}
|
|
|
|
func myrepolist() []string {
|
|
content, _ := ioutil.ReadFile("/home/jcarr/.config/myrepolist")
|
|
out := string(content)
|
|
out = strings.TrimSpace(out)
|
|
lines := strings.Split(out, "\n")
|
|
return lines
|
|
}
|
|
|
|
func (r *repo) Hide() {
|
|
r.pLabel.Hide()
|
|
r.pButton.Hide()
|
|
r.cButton.Hide()
|
|
r.lastTag.Hide()
|
|
r.vLabel.Hide()
|
|
|
|
r.masterName.Hide()
|
|
r.masterVersion.Hide()
|
|
r.develName.Hide()
|
|
r.develVersion.Hide()
|
|
r.userName.Hide()
|
|
r.userVersion.Hide()
|
|
r.dirtyLabel.Hide()
|
|
r.showButton.Hide()
|
|
r.hidden = true
|
|
}
|
|
|
|
func (r *repo) Show() {
|
|
r.pLabel.Show()
|
|
r.pButton.Show()
|
|
r.cButton.Show()
|
|
r.lastTag.Show()
|
|
r.vLabel.Show()
|
|
|
|
r.masterName.Show()
|
|
r.masterVersion.Show()
|
|
r.develName.Show()
|
|
r.develVersion.Show()
|
|
r.userName.Show()
|
|
r.userVersion.Show()
|
|
r.dirtyLabel.Show()
|
|
r.showButton.Show()
|
|
r.hidden = false
|
|
}
|