chinampa/internal/constants/help.md
2024-04-19 22:10:38 -06:00

1.9 KiB

{{- if not .HTMLOutput }}

{{ .Spec.FullName }}{{if eq .Command.Name "help"}} help{{end}}

{{- else -}}

description: {{ .Command.Short }}

{{- end }}

{{ .Command.Short }}

Usage

{{ replace .Command.UseLine " [flags]" "" }}{{if .Command.HasAvailableSubCommands}} SUBCOMMAND{{end}}

{{ if .Spec.IsRoot }}

Description

{{ if eq .Command.Name "help" -}} {{ .Command.Long }} {{- else -}} {{ .Spec.Description }} {{- end }} {{- if .Spec.HasAdditionalHelp }} {{ .Spec.AdditionalHelp .HTMLOutput }} {{ end -}} {{ end -}}

{{- if (and (not .Spec.IsRoot) .Spec.Description) }}

Description

{{ if not (eq .Command.Long "") }}{{ .Command.Long }}{{ else }}{{ .Spec.Description }}{{end}} {{- if .Spec.HasAdditionalHelp }} {{ .Spec.AdditionalHelp .HTMLOutput }} {{ end -}} {{ end }}

{{ if .Command.HasAvailableSubCommands -}}

Subcommands

{{ $hh := .HTMLOutput -}} {{ range .Command.Commands -}} {{- if (or .IsAvailableCommand (eq .Name "help")) -}}

  • {{ if $hh -}} {{ .Name }} {{- else -}} {{ .Name }} {{- end }} - {{.Short}} {{ end }} {{- end -}} {{- end -}}

{{- if .Spec.Arguments -}}

Arguments

{{ range .Spec.Arguments -}}

  • {{ .Name | toUpper }}{{ if .Variadic}}...{{ end }}{{ if .Required }} required{{ end }} - {{ .Description }} {{ end -}} {{- end -}}

{{- if (and .Command.HasAvailableLocalFlags .Spec.Options) }}

Options

{{ range $name, $opt := .Spec.Options -}}

  • --{{ $name }} ({{if $opt.Repeated}}[]{{end}}{{$opt.Type}}): {{ trimSuffix $opt.Description "."}}.{{if $opt.Repeated}} May be specified more than once. {{end}}{{ if $opt.Default }} Default: {{ $opt.Default }}.{{ end }} {{ end -}} {{- end -}}

{{- if .Command.HasAvailableInheritedFlags }}

Global Options

{{ range $name, $opt := .GlobalOptions -}}

  • --{{ $name }} ({{$opt.Type}}): {{$opt.Description}}.{{ if $opt.Default }} Default: {{ $opt.Default }}.{{ end }} {{ end -}} {{end}}