refactored data-types to reduce plugin sizes

This commit is contained in:
2026-06-08 07:02:56 +02:00
parent fec7cc546c
commit b6da9bcad4
90 changed files with 1039 additions and 803 deletions
+7 -4
View File
@@ -14,6 +14,9 @@ import (
"git.portale-stac.it/go-pkg/expr"
"git.portale-stac.it/go-pkg/expr/kern"
"git.portale-stac.it/go-pkg/expr/scan"
"git.portale-stac.it/go-pkg/expr/types"
"git.portale-stac.it/go-pkg/expr/types/array"
"git.portale-stac.it/go-pkg/expr/types/str"
"git.portale-stac.it/go-pkg/utils"
// https://pkg.go.dev/github.com/ergochat/readline#section-readme
@@ -225,10 +228,10 @@ func compute(opt *Options, ctx kern.ExprContext, r io.Reader, outputEnabled bool
func printResult(opt *Options, result any) {
if f, ok := result.(kern.Formatter); ok {
fmt.Println(f.ToString(opt.formOpt))
} else if kern.IsInteger(result) {
} else if types.IsInteger(result) {
fmt.Printf(opt.baseVerb, result)
fmt.Println()
} else if kern.IsString(result) {
} else if str.IsString(result) {
fmt.Printf("\"%s\"\n", result)
} else {
fmt.Println(result)
@@ -257,7 +260,7 @@ func registerLocalFunctions(ctx kern.ExprContext) {
vars := ctx.EnumVars(func(name string) bool {
return len(name) > 0 && name[0] == '_'
})
result = kern.ListFromStrings(vars)
result = array.ListFromStrings(vars)
return
}
@@ -309,7 +312,7 @@ func registerLocalFunctions(ctx kern.ExprContext) {
name, _, _ := strings.Cut(e, "=")
vars = append(vars, name)
}
result = kern.ListFromStrings(vars)
result = array.ListFromStrings(vars)
return
}