operator-builtin.go: builtin "" output the list of builtin module names
This commit is contained in:
+12
-1
@@ -10,6 +10,7 @@ import (
|
||||
"git.portale-stac.it/go-pkg/expr/kern"
|
||||
"git.portale-stac.it/go-pkg/expr/scan"
|
||||
"git.portale-stac.it/go-pkg/expr/sym"
|
||||
"git.portale-stac.it/go-pkg/expr/types/list"
|
||||
"git.portale-stac.it/go-pkg/expr/types/str"
|
||||
)
|
||||
|
||||
@@ -35,7 +36,17 @@ func evalBuiltin(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) {
|
||||
count := 0
|
||||
if str.IsString(childValue) {
|
||||
module, _ := childValue.(string)
|
||||
count, err = ImportInContextByGlobPattern(ctx, module)
|
||||
if module == "" {
|
||||
ll := list.NewLinkedList()
|
||||
IterateBuiltinModules(func(name, description string, imported bool) bool {
|
||||
ll.PushBack(name)
|
||||
return true
|
||||
})
|
||||
v = ll
|
||||
return
|
||||
} else {
|
||||
count, err = ImportInContextByGlobPattern(ctx, module)
|
||||
}
|
||||
} else {
|
||||
var moduleSpec any
|
||||
var it kern.Iterator
|
||||
|
||||
Reference in New Issue
Block a user