diff options
| author | Joe Richey joerichey@google.com <joerichey@google.com> | 2017-10-17 18:10:54 -0700 |
|---|---|---|
| committer | Joseph Richey <joerichey94@gmail.com> | 2017-10-19 02:22:28 -0700 |
| commit | 7847ab8270efab472b7b6a4bf9a57f5b83cb7212 (patch) | |
| tree | dc8cb96be83a978389cd59793d18ad13af8df312 /cmd/run.go | |
| parent | 36b313c802f9a8d23f2ad8ce5a59aa05f5925a2f (diff) | |
fmt almost done
Diffstat (limited to 'cmd/run.go')
| -rw-r--r-- | cmd/run.go | 34 |
1 files changed, 29 insertions, 5 deletions
@@ -48,22 +48,46 @@ var TemplateTitle = "{{.FullName}}{{if .Command.Title}} - {{.Command.Title}}{{en var TemplateUsage = `{{with $lines := .Command.UsageLines}}
Usage:
{{- range $lines}}
- {{$.FullName}} {{. -}}
+ {{printf "%s %s" $.FullName . | WrapText 8 2 -}}
{{end}}
{{end -}}
{{with $commands := .Command.SubCommands}}
+{{with $n := $.Command.MaxNameLength -}}
+{{with $fmt := printf "%%-%ds - %%s" $n -}}
Commands:
+{{if le (add 8 $n 3 $.Command.MaxTitleLength) LineLength -}}
+
+{{range $commands -}}
+
+{{end -}}
+
+{{else -}}
+
+{{range $commands}}
+{{end -}}
+
+{{end}}{{end}}{{end}}
+{{end -}}
+
+
{{- range $commands}}
- {{.Name}}{{if .Title}} - {{.Title}}{{end -}}
-{{end}}
+ {{if not .Title -}}
+ {{.Name -}}
+ {{else if le (add 8 $n 3 (len .Title)) LineLength -}}
+ {{printf $fmt .Name .Title -}}
+ {{else -}}
+ {{.Name}}
+ {{WrapText 16 2 .Title -}}
+ {{end -}}
+{{end}}{{end}}{{end}}
{{end -}}
{{with $arguments := .FullArguments}}
Arguments:
{{- range $arguments}}
{{.}}
- {{WrapText .Usage 2 -}}
+ {{WrapText 16 2 .Usage -}}
{{end}}
{{end -}}
@@ -71,7 +95,7 @@ Arguments: Options:
{{- range $flags}}
{{.}}
- {{WrapText .FullUsage 2 -}}
+ {{WrapText 16 2 .FullUsage -}}
{{end}}
{{end -}}
|