blob: bd7e06215be860efd9ac06c040ef53cea0a8f76a (
plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
{{ define "argName" }}{{ if not .required }}[{{ .name }}]{{else}}{{ .name }}{{end}}{{ end }}
{{- define "usage" }}### Usage
{{- $arguments := index . "arguments" | default coll.Slice }}
{{ if has . "rawUsage" }}{{ .rawUsage | strings.TrimSpace }}{{ else }}
```
{{ .name }}{{ range $a := $arguments }} {{template "argName" $a }}{{end}}
```
{{- if (index . "pipeline" | default false) }}
```
{{ $last := (sub (len $arguments) 1) -}}
{{ (index $arguments $last).name }} | {{ .name }}{{ range $i, $a := $arguments }}{{if not (eq $i $last)}} {{template "argName" $a }}{{end}}{{end}}
```
{{- end }}{{ end -}}
{{ end -}}
{{ $data := ds "data" -}}
---
title: {{ index $data "title" | default (print $data.ns " functions") }}
menu:
main:
parent: functions
---
{{ $data.preamble -}}
{{- define "annotations" -}}
{{ if not (has . "released") }}_(unreleased)_{{ end -}}
{{ if has . "deprecated" }} _(deprecated)_{{ end -}}
{{ if and (has . "experimental") (index . "experimental") }} _(experimental)_{{ end -}}
{{ end -}}
{{ range $_, $f := $data.funcs }}
## {{ if has $f "rawName" -}}
{{ $f.rawName }}{{ else }}`{{ $f.name }}`{{ end }}{{ template "annotations" $f }}
{{ if not (has . "released") -}}
**Unreleased:** _This function is in development, and not yet available in released builds of gomplate._
{{ end -}}
{{ if has $f "deprecated" -}}
**Deprecation Notice:** {{ $f.deprecated }}
{{ end -}}
{{ if and (has . "experimental") (index . "experimental") -}}
**Experimental:** This function is [_experimental_][experimental] and may be enabled with the [`--experimental`][experimental] flag.
[experimental]: ../config/#experimental
{{ end -}}
{{ if has $f "alias" }}
**Alias:** `{{$f.alias}}`
{{ end }}
{{- if has $f "description" }}
{{ $f.description }}
{{ end -}}
{{ if has . "released" -}}
_Added in gomplate [{{ $f.released }}](https://github.com/hairyhenderson/gomplate/releases/tag/{{ $f.released }})_
{{ end -}}
{{ template "usage" $f }}
{{ if has $f "arguments" -}}
### Arguments
| name | description |
|------|-------------|
{{ range $f.arguments }}| `{{.name}}` | _({{if .required}}required{{else}}optional{{end}})_ {{.description}} |
{{ end }}
{{- end -}}
{{if has $f "examples" }}
### Examples
{{ range $f.examples -}}
```console
{{ . | strings.TrimSpace }}
```
{{ end }}{{ end -}}
{{ if has $f "rawExamples" }}
### Examples
{{ range $f.rawExamples }}{{ . }}{{ end }}{{ end }}{{ end -}}
|