chinampa/internal/constants/help.md

71 lines
1.7 KiB
Markdown
Raw Normal View History

2022-12-19 03:04:34 +00:00
{{- if not .HTMLOutput }}
2022-12-30 07:00:26 +00:00
# {{ .Spec.FullName }}{{if eq .Command.Name "help"}} help{{end}}
2022-12-19 03:04:34 +00:00
{{- else }}
---
description: {{ .Command.Short }}
---
{{- end }}
{{ .Command.Short }}
## Usage
2022-12-29 19:05:58 +00:00
`{{ replace .Command.UseLine " [flags]" "" }}{{if .Command.HasAvailableSubCommands}} SUBCOMMAND{{end}}`
2022-12-19 03:04:34 +00:00
2022-12-30 07:00:26 +00:00
{{ if and .Spec.IsRoot (not (eq .Command.Name "help")) }}
## Description
{{ .Spec.Description }}
{{ end -}}
{{- if .Spec.HasAdditionalHelp }}
{{ .Spec.AdditionalHelp .HTMLOutput }}
{{ end -}}
{{- if (and (not .Spec.IsRoot) .Spec.Description) }}
## Description
{{ if not (eq .Command.Long "") }}{{ .Command.Long }}{{ else }}{{ .Spec.Description }}{{end}}
{{ end }}
2022-12-19 03:04:34 +00:00
{{ if .Command.HasAvailableSubCommands -}}
## Subcommands
{{ $hh := .HTMLOutput -}}
{{ range .Command.Commands -}}
{{- if (or .IsAvailableCommand (eq .Name "help")) -}}
- {{ if $hh -}}
2023-01-23 04:29:18 +00:00
[`{{ .Name }}`]({{.Name}}/)
2022-12-19 03:04:34 +00:00
{{- else -}}
2022-12-30 07:00:26 +00:00
`{{ .Name }}`
2022-12-19 03:04:34 +00:00
{{- end }} - {{.Short}}
{{ end }}
{{- end -}}
{{- end -}}
{{- if .Spec.Arguments -}}
## Arguments
{{ range .Spec.Arguments -}}
2022-12-30 07:00:26 +00:00
- `{{ .Name | toUpper }}{{ if .Variadic}}...{{ end }}`{{ if .Required }} _required_{{ end }} - {{ .Description }}
2022-12-19 03:04:34 +00:00
{{ end -}}
{{- end -}}
2022-12-30 07:00:26 +00:00
{{- if (and .Command.HasAvailableLocalFlags .Spec.Options) }}
2022-12-19 03:04:34 +00:00
## Options
{{ range $name, $opt := .Spec.Options -}}
2022-12-30 07:00:26 +00:00
- `--{{ $name }}` (_{{$opt.Type}}_): {{ trimSuffix $opt.Description "."}}.{{ if $opt.Default }} Default: _{{ $opt.Default }}_.{{ end }}
2022-12-19 03:04:34 +00:00
{{ end -}}
{{- end -}}
{{- if .Command.HasAvailableInheritedFlags }}
## Global Options
{{ range $name, $opt := .GlobalOptions -}}
2022-12-30 07:00:26 +00:00
- `--{{ $name }}` (_{{$opt.Type}}_): {{$opt.Description}}.{{ if $opt.Default }} Default: _{{ $opt.Default }}_.{{ end }}
2022-12-19 03:04:34 +00:00
{{ end -}}
{{end}}