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
|
||||
}
|
||||
|
||||
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()) {
|
||||
|
|
Loading…
Reference in New Issue