Renamed project to ucl

This commit is contained in:
Leon Mika 2024-04-27 10:11:22 +10:00
parent 1d7a076f63
commit 0b8c8a0d04
16 changed files with 159 additions and 108 deletions

View file

@ -3,7 +3,7 @@ package main
import (
"context"
"github.com/chzyer/readline"
"github.com/lmika/cmdlang-proto/cmdlang"
"github.com/lmika/ucl/ucl"
"log"
)
@ -14,7 +14,7 @@ func main() {
}
defer rl.Close()
inst := cmdlang.New()
inst := ucl.New()
ctx := context.Background()
for {
@ -23,7 +23,7 @@ func main() {
break
}
if err := inst.EvalAndDisplay(ctx, line); err != nil {
if err := ucl.EvalAndDisplay(ctx, inst, line); err != nil {
log.Printf("%T: %v", err, err)
}
}

View file

@ -7,9 +7,8 @@ import (
"context"
"errors"
"github.com/alecthomas/participle/v2"
"github.com/lmika/cmdlang-proto/cmdlang"
"github.com/lmika/ucl/ucl"
"strings"
"syscall/js"
)
func invokeUCLCallback(name string, args ...any) {
@ -21,7 +20,7 @@ func invokeUCLCallback(name string, args ...any) {
func initJS(ctx context.Context) {
ucl := make(map[string]any)
inst := cmdlang.New(cmdlang.WithOut(&uclOut{
inst := ucl.New(ucl.WithOut(&uclOut{
lineBuffer: new(bytes.Buffer),
writeLine: func(line string) {
invokeUCLCallback("onOutLine", line)