Add command

This commit is contained in:
Elara 2021-03-01 09:23:40 -08:00
parent cffba2f085
commit 16bcd39a0a

27
cmd/scpt/main.go Normal file
View File

@ -0,0 +1,27 @@
package main
import (
"flag"
"gitea.arsenm.dev/Arsen6331/scpt"
"log"
"os"
)
func main() {
filePath := flag.String("file", "", "File to parse")
flag.Parse()
if *filePath == "" {
log.Fatalln("Use --file to specify a file to parse")
}
file, err := os.Open(*filePath)
if err != nil {
log.Fatalln("Error opening specified file:", err)
}
ast, err := scpt.Parse(file)
if err != nil {
log.Fatalln("Error parsing file:", err)
}
ast.Execute()
}