2023-04-02 11:11:09 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
2023-04-14 10:59:37 +02:00
|
|
|
"git.defalsify.org/vise/engine"
|
2023-04-02 11:11:09 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
var dir string
|
|
|
|
var root string
|
2023-04-10 17:12:22 +02:00
|
|
|
var size uint
|
2023-04-15 08:06:03 +02:00
|
|
|
//var sessionId string
|
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")
|
2023-04-15 08:06:03 +02:00
|
|
|
//flag.StringVar(&sessionId, "session-id", "default", "session id")
|
2023-04-02 11:11:09 +02:00
|
|
|
flag.Parse()
|
|
|
|
fmt.Fprintf(os.Stderr, "starting session at symbol '%s' using resource dir: %s\n", root, dir)
|
|
|
|
|
|
|
|
ctx := context.Background()
|
2023-04-16 13:15:57 +02:00
|
|
|
en := engine.NewSizedEngine(dir, uint32(size))
|
|
|
|
err := engine.Loop(&en, os.Stdin, os.Stdout, ctx)
|
2023-04-16 09:51:16 +02:00
|
|
|
if err != nil {
|
|
|
|
fmt.Fprintf(os.Stderr, "loop exited with error: %v\n", err)
|
2023-04-02 11:11:09 +02:00
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|