• Home
Name Date Size #Lines LOC

..--

README.mdtD04-Jul-20252.4 KiB6755

generate.shD04-Jul-2025529 219

main.goD04-Jul-20252.1 KiB9467

README.mdt

1# Config API Reference
2
3[TOC]
4
5
6## Updating this Reference
7
8This reference is automatically generated based on Starlark docstrings. If you
9change a Starlark util function, run `util/docgen/generate.sh` to regenerate. A
10few tips:
11
12- Templating is based on Go's [`text/template`](https://golang.org/pkg/text/template/)
13package. Usually, the contents this template file won't need to be changed in
14order to regenerate.
15
16- Generation is based on docstrings, not the actual Starlark signatures. Thus,
17an "Args" section needs to be specified in the docstring in order for args to
18be picked up. Similarly, a "Returns" section needs to be specified in the
19docstring for returns to get picked up.
20
21- Specify "Required." after an argument to make it a required argument in the
22generated documentation.
23
24{{define "gen-funcs-doc"}}
25## {{.Module}}
26{{range $sym := .Symbols "func"}}
27### {{.FullName}} {#{{$sym.Anchor}}}
28{{$sym.Doc.Description | LinkifySymbols}}
29
30```python
31{{$sym.InvocationSnippet}}
32```
33{{if $sym.Doc.Args}}
34#### Arguments {#{{$sym.Anchor "args"}}}
35{{range $sym.Doc.Args}}
36* **{{.Name | EscapeMD}}**: {{.Desc | LinkifySymbols}}
37{{- end}}
38{{- end}}
39{{if $sym.Doc.Returns}}
40#### Returns  {#{{$sym.Anchor "returns"}}}
41{{$sym.Doc.Returns | LinkifySymbols}}
42{{end}}
43{{end}}
44{{end}}
45
46{{ $brand_config := Symbol "//config/util/brand_config.star" "brand_config" }}
47{{ $component := Symbol "//config/util/component.star" "comp" }}
48{{ $config_bundle := Symbol "//config/util/config_bundle.star" "config_bundle" }}
49{{ $design := Symbol "//config/util/design.star" "design" }}
50{{ $device_brand := Symbol "//config/util/device_brand.star" "device_brand" }}
51{{ $hw_topology := Symbol "//config/util/hw_topology.star" "hw_topo" }}
52{{ $partner := Symbol "//config/util/partner.star" "partner" }}
53{{ $program := Symbol "//config/util/program.star" "program" }}
54{{ $public_replication := Symbol "//config/util/public_replication.star" "public_replication" }}
55{{ $sw_config := Symbol "//config/util/sw_config.star" "sw_config" }}
56
57{{ template "gen-funcs-doc" $brand_config }}
58{{ template "gen-funcs-doc" $component }}
59{{ template "gen-funcs-doc" $config_bundle }}
60{{ template "gen-funcs-doc" $design }}
61{{ template "gen-funcs-doc" $device_brand }}
62{{ template "gen-funcs-doc" $hw_topology }}
63{{ template "gen-funcs-doc" $partner }}
64{{ template "gen-funcs-doc" $program }}
65{{ template "gen-funcs-doc" $public_replication }}
66{{ template "gen-funcs-doc" $sw_config }}
67