mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
fix: fix errorhandling and folder generation
This commit is contained in:
parent
d219d3e276
commit
fa07e36b2e
@ -10,6 +10,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
@ -40,7 +41,15 @@ func main() {
|
|||||||
"Title": strings.Title,
|
"Title": strings.Title,
|
||||||
}).ParseFiles("generator/textwidget.tpl")
|
}).ParseFiles("generator/textwidget.tpl")
|
||||||
|
|
||||||
out, _ := os.Create("generator/test.go")
|
err := os.Mkdir(strings.ToLower(widgetName), os.ModePerm)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
out, err := os.Create(fmt.Sprintf("%s/widget.go", strings.ToLower(widgetName)))
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err.Error())
|
||||||
|
}
|
||||||
defer out.Close()
|
defer out.Close()
|
||||||
|
|
||||||
tpl.Execute(out, data)
|
tpl.Execute(out, data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user