-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
format_troff.tmpl
64 lines (63 loc) · 1.75 KB
/
format_troff.tmpl
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
.\" DO NOT EDIT! Generated by github.com/gavv/cobradoc
.TH "{{ .Name | upper | escape }}" "{{ .SectionNumber | escape }}" "{{ .Date | escape }}" "{{ .Footer | escape }}" "{{ .Header | escape }}"
.SH NAME
{{ .Name | escape -}}
{{- if .ShortDescription }} \- {{ .ShortDescription | escape }}{{ end }}
.SH SYNOPSIS
\fB{{ .Name | escape }}\fR [\fIcommand\fR] [\fIglobal flags\fR] [\fIcommand flags\fR]
.SH DESCRIPTION
.PP
{{- if .LongDescription }}
{{ .LongDescription | escape }}
{{ end }}
Global flags:
{{ range $flag := .GlobalFlags }}
.TP
{{ if $flag.Short }}\fB{{ print "-" $flag.Short | escape }}\fP, {{ end -}}
\fB{{ print "--" $flag.Long | escape -}}\fP
{{- if not $flag.IsBool -}}
{{- if $flag.ValueIsOptional -}} [ {{- end -}}
=\fI
{{- if $flag.DefaultValue -}}
{{- $flag.DefaultValue | escape -}}
{{- else -}}
{{- $flag.Type | escape -}}
{{- end -}}
\fR
{{- if $flag.ValueIsOptional -}} ] {{- end -}}
{{- end }}
{{ $flag.Description | escape }}
{{- end }}
{{- range $group := .Groups }}
.SH {{ $group.Title | upper | escape }}
{{- range $command := $group.Commands }}
.TP
\fI{{ $command.Usage | escape }}\fR
{{ $command.Description | escape }}
.RS
Command flags:
{{ range $flag := $command.Flags }}
.TP
{{ if $flag.Short }}\fB{{ print "-" $flag.Short | escape }}\fP, {{ end -}}
\fB{{ print "--" $flag.Long | escape -}}\fP
{{- if not $flag.IsBool -}}
{{- if $flag.ValueIsOptional -}} [ {{- end -}}
=\fI
{{- if $flag.DefaultValue -}}
{{- $flag.DefaultValue | escape -}}
{{- else -}}
{{- $flag.Type | escape -}}
{{- end -}}
\fR
{{- if $flag.ValueIsOptional -}} ] {{- end -}}
{{- end }}
{{ $flag.Description | escape }}
{{- end }}
.RE
{{- end }}
{{- end }}
{{- range $section := .ExtraSections }}
.SH {{ $section.Title | upper | escape }}
.PP
{{ $section.Text | escape }}
{{- end }}