Skip to content
Permalink
Browse files

tools: add new genluaindex.go script

  • Loading branch information...
tsileo committed Oct 9, 2018
1 parent aa315fb commit bdb982342c59cba69b2dd0b1724272f4af749e25
Showing with 29 additions and 0 deletions.
  1. +29 −0 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.
You can’t perform that action at this time.