Skip to content

Commit

Permalink
tools: add new genluaindex.go script
Browse files Browse the repository at this point in the history
  • Loading branch information
tsileo committed Oct 9, 2018
1 parent aa315fb commit bdb9823
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tools/genluaindex.go
@@ -0,0 +1,29 @@
package main

import (
"io/ioutil"
"path/filepath"
"strings"

. "github.com/dave/jennifer/jen"
)

func main() {
files, err := filepath.Glob("lua/*.lua")
if err != nil {
panic(err)
}
f := NewFile("luascripts")
f.Comment("Autogenerated ; DO NOT EDIT")
f.Line()
f.Var().Id("files").Op("=").Map(String()).String().Values(DictFunc(func(d Dict) {
for _, fi := range files {
dat, err := ioutil.ReadFile(fi)
if err != nil {
panic(err)
}
d[Lit(strings.Replace(fi, "lua/", "", 1))] = Lit(string(dat))
}
}))
f.Save("pkg/luascripts/files.go")
}

0 comments on commit bdb9823

Please sign in to comment.