{{ 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 -}}