整理打印

This commit is contained in:
2025-10-03 00:54:22 +08:00
parent bff7f73d8b
commit 73480005eb
6 changed files with 63 additions and 3 deletions
+11
View File
@@ -1,6 +1,7 @@
package template
import (
"fmt"
"strings"
"text/template"
)
@@ -18,6 +19,16 @@ var DefaultFuncMap = template.FuncMap{
splits := strings.Split(str, "/")
return splits[len(splits)-1]
},
"exports": func(port []any) string {
var out []string
for _, p := range port {
p2 := p.(map[string]interface{})
splits := strings.Split(p2["Cmd"].(string), "/")
funcName := splits[len(splits)-1]
out = append(out, fmt.Sprintf("%s/5", funcName))
}
return strings.Join(out, ",")
},
}
func hd(str []string) string {