37 lines
621 B
Go
37 lines
621 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
|
|
"reichard.io/poiesis/internal/functions"
|
|
"reichard.io/poiesis/internal/runtime"
|
|
)
|
|
|
|
func main() {
|
|
if len(os.Args) < 2 {
|
|
fmt.Fprintln(os.Stderr, "Usage: poiesis <typescript-file>")
|
|
fmt.Fprintln(os.Stderr, " poiesis -print-types")
|
|
os.Exit(1)
|
|
}
|
|
|
|
// Print Types
|
|
if os.Args[1] == "-print-types" {
|
|
fmt.Println(functions.GetFunctionDeclarations())
|
|
return
|
|
}
|
|
|
|
// Create Runtime
|
|
rt, err := runtime.New(context.Background())
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// Run File
|
|
filePath := os.Args[1]
|
|
if err := rt.RunFile(filePath); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|