show user defined section
This commit is contained in:
parent
f8c07556f9
commit
1bdf8e2f0e
|
@ -58,6 +58,16 @@ func CheckRegistered(rs *repostatus.RepoStatus) (bool, string) {
|
||||||
return found, source
|
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 {
|
func ListWindow() *gadgets.BasicWindow {
|
||||||
if lw != nil {
|
if lw != nil {
|
||||||
if lw.Hidden() {
|
if lw.Hidden() {
|
||||||
|
@ -79,7 +89,14 @@ func ListWindow() *gadgets.BasicWindow {
|
||||||
})
|
})
|
||||||
|
|
||||||
var lines []string
|
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")
|
lines = dumpURL("https://go.wit.com/list")
|
||||||
for i, line := range lines {
|
for i, line := range lines {
|
||||||
|
@ -87,21 +104,25 @@ func ListWindow() *gadgets.BasicWindow {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if line[0] == '#' {
|
if line[0] == '#' {
|
||||||
curs = NewSection(group, line)
|
currents = NewSection(group, line)
|
||||||
log.Warn("new group:", line)
|
log.Warn("new group:", line)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Warn(i, line)
|
log.Warn(i, line)
|
||||||
parts := strings.Split(line, " ")
|
parts := strings.Split(line, " ")
|
||||||
if curs != nil {
|
if currents != nil {
|
||||||
curs.add(parts[0])
|
currents.add(parts[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i, sec := range allsections {
|
for i, sec := range allsections {
|
||||||
log.Info("section name:", sec.name, "hidden:", sec.hidden, i)
|
log.Info("section name:", sec.name, "hidden:", sec.hidden, i)
|
||||||
parts := strings.Split(sec.name, " ")
|
parts := strings.Split(sec.name, " ")
|
||||||
if len(parts) > 1 {
|
if len(parts) > 1 {
|
||||||
if parts[1] != "Applications" {
|
if parts[1] == "Applications" {
|
||||||
|
// leave expanded
|
||||||
|
} else if parts[0] == "local" {
|
||||||
|
// leave expanded
|
||||||
|
} else {
|
||||||
sec.Hide()
|
sec.Hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,6 +169,7 @@ func (r *witRepo) doDownload() bool {
|
||||||
*/
|
*/
|
||||||
if r.downloadB.String() == "downloaded" {
|
if r.downloadB.String() == "downloaded" {
|
||||||
log.Info("skipping already downloaded", r.path.String())
|
log.Info("skipping already downloaded", r.path.String())
|
||||||
|
r.downloadB.Disable()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if downloadRepo(r.path.String()) {
|
if downloadRepo(r.path.String()) {
|
||||||
|
|
Loading…
Reference in New Issue