-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelp.tpl
More file actions
77 lines (72 loc) · 2.07 KB
/
help.tpl
File metadata and controls
77 lines (72 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{{- /* Heavily inspired by the Go toolchain and fd */ -}}
{{prettyHeader "Usage"}}
{{indent .FullUsage 2}}
{{ with .Short }}
{{- indent . 2 | wrapTTY }}
{{"\n"}}
{{- end}}
{{- with .Deprecated }}
{{- indent (printf "DEPRECATED: %s" .) 2 | wrapTTY }}
{{"\n"}}
{{- end }}
{{ with .Aliases }}
{{" Aliases: "}} {{- joinStrings .}}
{{- end }}
{{- with .Long}}
{{"\n"}}
{{- indent . 2}}
{{ "\n" }}
{{- end }}
{{- with .Args }}
{{- if gt (len .) 0 }}
{{ prettyHeader "Arguments" }}
{{- "\n" }}
{{- range $index, $arg := . }}
{{- formatArg $arg $index }}
{{- end }}
{{- end }}
{{- end }}
{{ with visibleChildren . }}
{{- range $index, $child := . }}
{{- if eq $index 0 }}
{{ prettyHeader "Subcommands"}}
{{- end }}
{{- "\n" }}
{{- formatSubcommand . | trimNewline }}
{{- end }}
{{- "\n" }}
{{- end }}
{{- $groups := optionGroups . }}
{{- if gt (len $groups) 0 }}
{{- range $index, $group := $groups }}
{{ prettyHeader (printf "%s Options" $group.Name) }}
{{- range $optIndex, $option := $group.Options }}
{{- if not (eq $option.Shorthand "") }}{{- print "\n "}} {{ keyword "-"}}{{keyword $option.Shorthand }}{{", "}}
{{- else }}{{- print "\n " -}}
{{- end }}
{{- with flagName $option }}{{keyword "--"}}{{ keyword . }}{{ end }} {{- with typeHelper $option }} {{ . }}{{ end }}
{{- with envName $option }}, {{ . | keyword }}{{ end }}
{{- if or $option.Default $option.Required }}{{- " (" -}}
{{- with $option.Default }}default: {{ . }}{{ end }}
{{- if and $option.Default $option.Required }}, {{ end }}
{{- if $option.Required }}required{{ end }}
{{- ")" -}}{{- end }}
{{- with $option.Description }}
{{- $desc := $option.Description }}
{{ indent $desc 10 }}
{{- if isDeprecated $option }}
{{- if $option.Deprecated }}
{{ indent (printf "DEPRECATED: %s" $option.Deprecated) 10 }}
{{- else }}
{{ indent "DEPRECATED: This option is deprecated." 10 }}
{{- end }}
{{- end }}
{{- end -}}
{{- end }}
{{- end }}
{{- end }}
{{- if hasParent . }}
———
Run `{{ rootCommandName . }} --help` for a list of global options.
{{- else }}
{{- end }}