From c31025c8cde7d7903b0f1a9b55be96cdc93fbbde Mon Sep 17 00:00:00 2001 From: Celestino Amoroso Date: Sun, 2 Aug 2026 17:06:57 +0200 Subject: [PATCH] operator-builtin.go: builtin "" output the list of builtin module names --- operator-builtin.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/operator-builtin.go b/operator-builtin.go index 2bfb1e3..557bbb6 100644 --- a/operator-builtin.go +++ b/operator-builtin.go @@ -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