forked from i-love-flamingo/flamingo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tplfuncs.go
45 lines (42 loc) · 1.37 KB
/
tplfuncs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package command
import (
"fmt"
"github.com/spf13/cobra"
)
var (
TplfuncsCmd = &cobra.Command{
Use: "tplfuncs",
Short: "Debug Template Functions",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("\nContainer for Routed Contexts:")
fmt.Println()
for _, routeConfig := range ConfigArea.GetFlatContexts() {
if contextName != "" && contextName != routeConfig.Name {
continue
}
bu, _ := routeConfig.Configuration.Get("prefixrouter.baseurl")
baseurl, ok := bu.(string)
if !ok {
continue
}
if baseURL != "" && baseURL != baseurl {
continue
}
fmt.Println()
fmt.Println("********************************************")
fmt.Println("Routed Context - Baseurl:" + baseurl + " Contextpath: [" + routeConfig.Name + "]")
//tfr := routeConfig.Injector.GetInstance(template.FunctionRegistry{}).(*template.FunctionRegistry)
fmt.Println("Functions")
//for _, f := range tfr.templateFunctions {
// fmt.Printf("%s: %s (from %s)\n", f.Name(), reflect.ValueOf(f.Func()).String(), reflect.ValueOf(f).Type().String())
//}
fmt.Println()
fmt.Println("Context Functions")
//for _, f := range tfr.contextTemplateFunctions {
// fmt.Printf("%s: %s (from %s)\n", f.Name(), reflect.ValueOf(f.Func(web.NewContext())).String(), reflect.ValueOf(f).Type().String())
//}
fmt.Println()
}
},
}
)