2023-04-02 11:11:09 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"git.defalsify.org/festive/engine"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
var dir string
|
|
|
|
var root string
|
2023-04-10 17:12:22 +02:00
|
|
|
var size uint
|
2023-04-02 11:11:09 +02:00
|
|
|
flag.StringVar(&dir, "d", ".", "resource dir to read from")
|
2023-04-10 17:12:22 +02:00
|
|
|
flag.UintVar(&size, "s", 0, "max size of output")
|
2023-04-02 11:11:09 +02:00
|
|
|
flag.StringVar(&root, "root", "root", "entry point symbol")
|
|
|
|
flag.Parse()
|
|
|
|
fmt.Fprintf(os.Stderr, "starting session at symbol '%s' using resource dir: %s\n", root, dir)
|
|
|
|
|
|
|
|
ctx := context.Background()
|
2023-04-10 17:12:22 +02:00
|
|
|
en := engine.NewSizedEngine(dir, uint32(size))
|
2023-04-10 09:07:08 +02:00
|
|
|
err := engine.Loop(&en, root, ctx, os.Stdin, os.Stdout)
|
2023-04-02 11:11:09 +02:00
|
|
|
if err != nil {
|
2023-04-09 16:58:35 +02:00
|
|
|
fmt.Fprintf(os.Stderr, "loop exited with error: %v", err)
|
2023-04-02 11:11:09 +02:00
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|