MCPcopy
hub / github.com/tinyauthapp/tinyauth / generateMarkdown

Function generateMarkdown

gen/gen_md.go:23–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21}
22
23func generateMarkdown() {
24 cfg := config.NewDefaultConfiguration()
25 entries := make([]MarkdownEntry, 0)
26
27 root := reflect.TypeOf(cfg).Elem()
28 rootValue := reflect.ValueOf(cfg).Elem()
29 rootPath := "tinyauth."
30
31 walkAndBuild(root, rootValue, rootPath, &entries, buildMdEntry, buildMdMapEntry, buildMdChildPath)
32 compiled := compileMd(entries)
33
34 err := os.Remove("config.gen.md")
35 if err != nil && !errors.Is(err, fs.ErrNotExist) {
36 slog.Error("failed to remove example env file", "error", err)
37 os.Exit(1)
38 }
39
40 err = os.WriteFile("config.gen.md", compiled, 0644)
41 if err != nil {
42 slog.Error("failed to write example env file", "error", err)
43 os.Exit(1)
44 }
45}
46
47func buildMdEntry(child reflect.StructField, childValue reflect.Value, parentPath string, entries *[]MarkdownEntry) {
48 desc := child.Tag.Get("description")

Callers 1

mainFunction · 0.85

Calls 3

NewDefaultConfigurationFunction · 0.92
walkAndBuildFunction · 0.85
compileMdFunction · 0.85

Tested by

no test coverage detected