Back to Vector

Commands

website/layouts/shortcodes/cli/commands.html

0.55.02.6 KB
Original Source

{{ $cli := site.Data.docs.cli }}

{{ $cli.name }}

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 }}RequiredDescriptionTypeDefault
{{ range $k, $v := .items }}{{ $k }}{{ $v.required }}{{ $v.descriptionmarkdownify }}
{{ end }}
{{ end }} {{ define "options-table" }} {{ $cmd := .cmd }}
{{ .title }}DescriptionEnvironment variableDefault
{{ 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 }}
{{ .descriptionmarkdownify }}
{{ with .enum }}
Enum options
OptionDescription
{{ range $k, $v := . }}`
                {{ $k }}
              ` | {{ $v }} |

{{ end }}

{{ end }} | {{ with .env_var }} {{ . }} {{ end }} | {{ .default }} | {{ end }} {{ end }}