{{ define "article" }} {{ $data := index site.Data.sbx_cli .Params.datafile }} {{ .Store.Set "headings" slice }}
{{ partial "breadcrumbs.html" . }}

{{ .Title }}

{{- /* Summary table */ -}}
{{ with $data.synopsis }} {{ end }} {{ with $data.usage }} {{ end }}
Description {{ . }}
Usage {{ . }}
{{- /* Description */ -}} {{ with $data.description }} {{ $heading := dict "level" 2 "text" "Description" }} {{ partialCached "heading.html" $heading "sbx-cli-description" }} {{ $.Store.Add "headings" $heading }} {{ . | $.RenderString (dict "display" "block") }} {{ end }} {{- /* Subcommands (for section pages) */ -}} {{ if eq .Kind "section" }} {{ $heading := dict "level" 2 "text" "Commands" }} {{ partialCached "heading.html" $heading "sbx-cli-commands" }} {{ $.Store.Add "headings" $heading }} {{ range .Pages }} {{ if .Params.datafile }} {{ $child := index site.Data.sbx_cli .Params.datafile }} {{ end }} {{ end }}
Command Description
{{ .Title }} {{ $child.synopsis }}
{{ end }} {{- /* Options */ -}} {{ with $data.options }} {{ $opts := where . "name" "ne" "help" }} {{ with $opts }} {{ $heading := dict "level" 2 "text" "Options" }} {{ partialCached "heading.html" $heading "sbx-cli-options" }} {{ $.Store.Add "headings" $heading }}
{{ range . }} {{ $skipDefault := `[],false,` }} {{ end }}
Option Default Description
{{ with .shorthand }}-{{ . }}, {{ end }}--{{ .name }} {{ with .default_value }} {{ cond (in $skipDefault .) "" (printf "%s" . | safeHTML) }} {{ end }} {{ with .usage }} {{ strings.TrimSpace . }} {{ end }}
{{ end }} {{ end }} {{- /* Inherited (global) options */ -}} {{ with $data.inherited_options }} {{ $opts := where . "name" "ne" "help" }} {{ with $opts }} {{ $heading := dict "level" 2 "text" "Global options" }} {{ partialCached "heading.html" $heading "sbx-cli-global-options" }} {{ $.Store.Add "headings" $heading }}
{{ range . }} {{ $skipDefault := `[],false,` }} {{ end }}
Option Default Description
{{ with .shorthand }}-{{ . }}, {{ end }}--{{ .name }} {{ with .default_value }} {{ cond (in $skipDefault .) "" (printf "%s" . | safeHTML) }} {{ end }} {{ with .usage }} {{ strings.TrimSpace . }} {{ end }}
{{ end }} {{ end }} {{- /* Examples */ -}} {{ with $data.example }} {{ $heading := dict "level" 2 "text" "Examples" }} {{ partialCached "heading.html" $heading "sbx-cli-examples" }} {{ $.Store.Add "headings" $heading }} {{- /* Dedent: strip up to 6 leading spaces from each line */ -}} {{ $dedented := replaceRE `(?m)^ {2,6}` "" . }} {{ $code := printf "```console\n%s\n```" (strings.TrimSpace $dedented) }} {{ $code | $.RenderString (dict "display" "block") }} {{ end }}
{{ end }} {{ define "right" }} {{ end }}