skip comments in config file
This commit is contained in:
parent
f8963c7563
commit
f82ca7a951
2
Makefile
2
Makefile
|
@ -1,6 +1,6 @@
|
|||
all:
|
||||
@echo this is a go library, not a binary
|
||||
@GO111MODULE=off go build
|
||||
@echo this is a go library with buildable code
|
||||
|
||||
goimports:
|
||||
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)")
|
||||
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, " ")
|
||||
log.Info("adding:", i, parts)
|
||||
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)
|
||||
tmp.downloadB.SetLabel("downloaded")
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -228,7 +241,7 @@ func NewSection(parent *gui.Node, desc string) *section {
|
|||
}
|
||||
lw.Enable()
|
||||
})
|
||||
news.grid = news.parent.NewGrid("sections", 2, 1)
|
||||
news.grid = news.parent.NewGrid("sections", 0, 0)
|
||||
allsections = append(allsections, news)
|
||||
return news
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue