@@ -19,48 +19,48 @@ import (
19
19
"github.com/kopia/kopia/repo"
20
20
)
21
21
22
- const usageTemplate = `{{define "FormatCommand"}}\
23
- {{if .FlagSummary}} {{.FlagSummary}}{{end}}\
24
- {{range .Args}} {{if not .Required}}[{{end}}<{{.Name}}>{{if .Value|IsCumulative}}...{{end}}{{if not .Required}}]{{end}}{{end}}\
25
- {{end}}\
26
- {{define "FormatCommandList"}}\
27
- {{range .}}\
28
- {{if not .Hidden}}\
29
- {{.Depth|Indent}}{{.Name}}{{if .Default}}*{{end}}{{template "FormatCommand" .}}
30
- {{template "FormatCommandList" .Commands}}\
31
- {{end}}\
32
- {{end}}\
33
- {{end}}\
34
- {{define "FormatUsage"}}\
35
- {{template "FormatCommand" .}}{{if .Commands}} <command> [<args> ...]{{end}}
22
+ const usageTemplate = `{{define "FormatCommand" -}}
23
+ {{if .FlagSummary}} {{.FlagSummary - }}{{end -}}
24
+ {{range .Args}} {{if not .Required}}[{{end - }}<{{.Name - }}>{{if .Value|IsCumulative}}...{{end}}{{if not .Required}}]{{end}}{{end -}}
25
+ {{end -}}
26
+ {{define "FormatCommandList" -}}
27
+ {{range . -}}
28
+ {{if not .Hidden -}}
29
+ {{.Depth|Indent - }}{{.Name - }}{{if .Default - }}*{{end - }}{{template "FormatCommand" .}}
30
+ {{template "FormatCommandList" .Commands -}}
31
+ {{end -}}
32
+ {{end -}}
33
+ {{end -}}
34
+ {{define "FormatUsage" -}}
35
+ {{template "FormatCommand" .}}{{if .Commands}} <command> [<args> ...]{{end - }}
36
36
{{if .Help}}
37
- {{.Help|Wrap 0}}\
38
- {{end}}\
39
- {{end}}\
40
- {{if .Context.SelectedCommand}}\
37
+ {{.Help|Wrap 0 -}}
38
+ {{end -}}
39
+ {{end}}
40
+ {{if .Context.SelectedCommand -}}
41
41
usage: {{.App.Name}} {{.Context.SelectedCommand}}{{template "FormatUsage" .Context.SelectedCommand}}
42
- {{else}}\
42
+ {{else -}}
43
43
usage: {{.App.Name}}{{template "FormatUsage" .App}}
44
- {{end}}\
45
- {{if .Context.Flags}}\
44
+ {{end -}}
45
+ {{if .Context.Flags -}}
46
46
Flags:
47
47
{{.Context.Flags|FlagsToTwoColumns|FormatTwoColumns}}
48
- {{end}}\
49
- {{if .Context.Args}}\
48
+ {{end -}}
49
+ {{if .Context.Args -}}
50
50
Args:
51
51
{{.Context.Args|ArgsToTwoColumns|FormatTwoColumns}}
52
- {{end}}\
53
- {{if .Context.SelectedCommand}}\
54
- {{if .Context.SelectedCommand.Commands}}\
52
+ {{end -}}
53
+ {{if .Context.SelectedCommand -}}
54
+ {{if .Context.SelectedCommand.Commands -}}
55
55
Subcommands:
56
56
{{.Context.SelectedCommand}}
57
- {{template "FormatCommandList" .Context.SelectedCommand.Commands}}
58
- {{end}}\
59
- {{else if .App.Commands}}\
57
+ {{template "FormatCommandList" .Context.SelectedCommand.Commands - }}
58
+ {{end -}}
59
+ {{else if .App.Commands -}}
60
60
Commands (use --help-full to list all commands):
61
61
62
- {{template "FormatCommandList" .App.Commands}}
63
- {{end}}\
62
+ {{template "FormatCommandList" .App.Commands - }}
63
+ {{end -}}
64
64
`
65
65
66
66
func main () {
0 commit comments