chinampa/internal/constants/help.md

78 lines
1.9 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}}
2023-03-23 06:14:43 +00:00
{{- else -}}
2022-12-19 03:04:34 +00:00
---
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
2023-03-24 01:51:36 +00:00
{{ if .Spec.IsRoot }}
2022-12-30 07:00:26 +00:00
## Description
2023-03-24 01:51:36 +00:00
{{ if eq .Command.Name "help" -}}
{{ .Command.Long }}
{{- else -}}
2022-12-30 07:00:26 +00:00
{{ .Spec.Description }}
2023-03-24 01:51:36 +00:00
{{- end }}
2022-12-30 07:00:26 +00:00
{{- if .Spec.HasAdditionalHelp }}
{{ .Spec.AdditionalHelp .HTMLOutput }}
{{ end -}}
2023-03-23 06:14:43 +00:00
{{ end -}}
2022-12-30 07:00:26 +00:00
{{- if (and (not .Spec.IsRoot) .Spec.Description) }}
## Description
{{ if not (eq .Command.Long "") }}{{ .Command.Long }}{{ else }}{{ .Spec.Description }}{{end}}
2023-03-23 06:14:43 +00:00
{{- if .Spec.HasAdditionalHelp }}
{{ .Spec.AdditionalHelp .HTMLOutput }}
{{ end -}}
2022-12-30 07:00:26 +00:00
{{ 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 -}}
2024-04-20 04:10:38 +00:00
- `--{{ $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 }}
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}}