Split out CLI
This commit is contained in:
35
grow/cli/main.go
Normal file
35
grow/cli/main.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user