skip comments in config file
This commit is contained in:
parent
f8963c7563
commit
f82ca7a951
2
Makefile
2
Makefile
|
@ -1,6 +1,6 @@
|
||||||
all:
|
all:
|
||||||
@echo this is a go library, not a binary
|
|
||||||
@GO111MODULE=off go build
|
@GO111MODULE=off go build
|
||||||
|
@echo this is a go library with buildable code
|
||||||
|
|
||||||
goimports:
|
goimports:
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package gowit
|
||||||
|
|
||||||
|
/*
|
||||||
|
this enables command line options from other packages like 'gui' and 'log'
|
||||||
|
*/
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
var WIT *log.LogFlag
|
||||||
|
var WITWARN *log.LogFlag
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
full := "go.wit.com/lib/gui/gowit"
|
||||||
|
short := "gowit"
|
||||||
|
|
||||||
|
WIT = log.NewFlag("WIT", true, full, short, "general go.wit.com things")
|
||||||
|
WITWARN = log.NewFlag("WITWARN", true, full, short, "wit.com warnings")
|
||||||
|
}
|
|
@ -94,6 +94,15 @@ func ListWindow(view *repolist.RepoList) *gadgets.BasicWindow {
|
||||||
|
|
||||||
currents = NewSection(group, "local (~/.config/myrepolist)")
|
currents = NewSection(group, "local (~/.config/myrepolist)")
|
||||||
for i, line := range myrepolist() {
|
for i, line := range myrepolist() {
|
||||||
|
line = strings.TrimSpace(line)
|
||||||
|
if line == "" {
|
||||||
|
// skip blank lines
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(line, "#") {
|
||||||
|
// skip comment lines
|
||||||
|
continue
|
||||||
|
}
|
||||||
parts := strings.Split(line, " ")
|
parts := strings.Split(line, " ")
|
||||||
log.Info("adding:", i, parts)
|
log.Info("adding:", i, parts)
|
||||||
currents.add(view, parts[0])
|
currents.add(view, parts[0])
|
||||||
|
@ -202,8 +211,12 @@ func (s *section) add(view *repolist.RepoList, path string) {
|
||||||
log.Verbose("repo is already downloaded", path)
|
log.Verbose("repo is already downloaded", path)
|
||||||
tmp.downloadB.SetLabel("downloaded")
|
tmp.downloadB.SetLabel("downloaded")
|
||||||
tmp.downloadB.Disable()
|
tmp.downloadB.Disable()
|
||||||
|
s.grid.NewButton("Configure", func() {
|
||||||
|
log.Log(WIT, "todo: open the repo window here")
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.grid.NextRow()
|
||||||
s.witRepos = append(s.witRepos, tmp)
|
s.witRepos = append(s.witRepos, tmp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +241,7 @@ func NewSection(parent *gui.Node, desc string) *section {
|
||||||
}
|
}
|
||||||
lw.Enable()
|
lw.Enable()
|
||||||
})
|
})
|
||||||
news.grid = news.parent.NewGrid("sections", 2, 1)
|
news.grid = news.parent.NewGrid("sections", 0, 0)
|
||||||
allsections = append(allsections, news)
|
allsections = append(allsections, news)
|
||||||
return news
|
return news
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue