summaryrefslogtreecommitdiff
path: root/listWindow.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-15 22:50:01 -0600
committerJeff Carr <[email protected]>2024-02-15 22:50:01 -0600
commit1bdf8e2f0e10b0dbb8413d855d67cf4cb57b1aaa (patch)
treec31e545d2706676dcf252b68a47a8cc68883d98a /listWindow.go
parentf8c07556f9b93745b4165e2b9e419b662d95c3b9 (diff)
show user defined section
Diffstat (limited to 'listWindow.go')
-rw-r--r--listWindow.go32
1 files changed, 27 insertions, 5 deletions
diff --git a/listWindow.go b/listWindow.go
index ec69783..3b896e0 100644
--- a/listWindow.go
+++ b/listWindow.go
@@ -58,6 +58,16 @@ func CheckRegistered(rs *repostatus.RepoStatus) (bool, string) {
return found, source
}
+func myrepolist() []string {
+ homeDir, _ := os.UserHomeDir()
+ cfgfile := filepath.Join(homeDir, ".config/myrepolist")
+ content, _ := ioutil.ReadFile(cfgfile)
+ out := string(content)
+ out = strings.TrimSpace(out)
+ lines := strings.Split(out, "\n")
+ return lines
+}
+
func ListWindow() *gadgets.BasicWindow {
if lw != nil {
if lw.Hidden() {
@@ -79,7 +89,14 @@ func ListWindow() *gadgets.BasicWindow {
})
var lines []string
- var curs *section
+ var currents *section
+
+ currents = NewSection(group, "local (~/.config/myrepolist)")
+ for i, line := range myrepolist() {
+ parts := strings.Split(line, " ")
+ log.Info("adding:", i, parts)
+ currents.add(parts[0])
+ }
lines = dumpURL("https://go.wit.com/list")
for i, line := range lines {
@@ -87,21 +104,25 @@ func ListWindow() *gadgets.BasicWindow {
continue
}
if line[0] == '#' {
- curs = NewSection(group, line)
+ currents = NewSection(group, line)
log.Warn("new group:", line)
continue
}
log.Warn(i, line)
parts := strings.Split(line, " ")
- if curs != nil {
- curs.add(parts[0])
+ if currents != nil {
+ currents.add(parts[0])
}
}
for i, sec := range allsections {
log.Info("section name:", sec.name, "hidden:", sec.hidden, i)
parts := strings.Split(sec.name, " ")
if len(parts) > 1 {
- if parts[1] != "Applications" {
+ if parts[1] == "Applications" {
+ // leave expanded
+ } else if parts[0] == "local" {
+ // leave expanded
+ } else {
sec.Hide()
}
}
@@ -148,6 +169,7 @@ func (r *witRepo) doDownload() bool {
*/
if r.downloadB.String() == "downloaded" {
log.Info("skipping already downloaded", r.path.String())
+ r.downloadB.Disable()
return true
}
if downloadRepo(r.path.String()) {