website/layouts/shortcodes/cli/commands.html
{{ $cli := site.Data.docs.cli }}
The root command (no subcommand) starts Vector.
{{ highlight "vector [FLAGS] [OPTIONS] [SUBCOMMAND] [ARGS]" "shell" "" }}
{{ template "options-table" (dict "title" "Flags" "items" $cli.flags "cmd" "vector") }}
{{ template "options-table" (dict "title" "Options" "items" $cli.options "cmd" "vector") }}
{{ range $k, $v := $cli.commands }} {{ partial "heading.html" (dict "text" (printf "vector %s" $k) "level" 3 "mono" true "id" $k) }} {{ with $v.description }} {{ . | markdownify }} {{ end }} {{ template "usage" $v }} {{ with $v.example }} {{ partial "heading.html" (dict "text" "Example" "level" 4 "toc_hide" true) }} {{ highlight . "shell" "" }}
{{ end }} {{ with $v.flags }} {{ template "options-table" (dict "title" "Flags" "items" . "cmd" $k) }} {{ end }} {{ with $v.options }} {{ template "options-table" (dict "title" "Options" "items" . "cmd" $k) }} {{ end }} {{ with $v.args }} {{ template "args-table" (dict "title" "Arguments" "items" . "cmd" $k) }} {{ end }}
{{ end }} {{ define "usage" }} {{ $s := printf "vector %s" .name }} {{ if .flags }} {{ $s = printf "%s [FLAGS]" $s }} {{ end }} {{ if .options }} {{ $s = printf "%s [OPTIONS]" $s }} {{ end }} {{ if .args }} {{ $s = printf "%s [ARGUMENTS]" $s }} {{ end }} {{ highlight $s "shell" "" }} {{ end }} {{ define "args-table" }}
| {{ .title }} | Required | Description | Type | Default |
|---|---|---|---|---|
| {{ range $k, $v := .items }} | {{ $k }} | {{ $v.required }} | {{ $v.description | markdownify }} |
| {{ end }} | ||||
| {{ end }} {{ define "options-table" }} {{ $cmd := .cmd }} |
| {{ .title }} | Description | Environment variable | Default |
|---|---|---|---|
| {{ range .items }} | {{ if .flag }} {{ $id := substr .flag 2 }} {{ $href := printf "%s-%s" $cmd $id }} {{ $comma := and .flag .short }} {{- .flag -}} {{ if $comma }}, | ||
| {{ end }} {{ with .short }} {{ . }} {{ end }} | {{ end }} {{ if .option }} {{ $id := substr .option 2 }} {{ $href := printf "%s-%s" $cmd $id }} {{ $comma := and .option .short }} {{- .option -}} {{ if $comma }}, | ||
| {{ end }} {{ with .short }} {{ . }} {{ end }} | {{ end }} | ||
| {{ .description | markdownify }} | ||
| {{ with .enum }} | |||
| Enum options |
| Option | Description |
|---|---|
| {{ range $k, $v := . }} | ` |
{{ $k }}
` | {{ $v }} |
{{ end }}
{{ end }} | {{ with .env_var }} {{ . }} {{ end }} | {{ .default }} |
{{ end }}
{{ end }}