Split out CLI

This commit is contained in:
Ian Gulliver
2021-11-20 19:38:31 -10:00
parent 8097d6d24f
commit 0850ada0c4
4 changed files with 19 additions and 13 deletions

35
grow/cli/main.go Normal file
View File

@@ -0,0 +1,35 @@
package main
import "flag"
import "log"
import "math/rand"
import "os"
import "time"
import "github.com/firestuff/subcoding/grow"
func main() {
defPath := flag.String("def-path", "", "path to definition YAML file")
flag.Parse()
if *defPath == "" {
log.Fatal("Please specify --def-path")
}
rand.Seed(time.Now().UnixNano())
defFile, err := os.Open(*defPath)
if err != nil {
log.Fatal(err)
}
def, err := grow.NewDefinition(defFile)
if err != nil {
log.Fatal(err)
}
_, err = def.Grow()
if err != nil {
log.Fatal(err)
}
}