cmd/doc: fixed outputs label

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-06-07 11:53:03 +02:00
parent a002d2e02e
commit 1bfb8d4369

View File

@ -149,7 +149,6 @@ func loadCode(packageName string) (*compiler.Value, error) {
// printValuesText (text) formats an array of Values on stdout // printValuesText (text) formats an array of Values on stdout
func printValuesText(iw io.Writer, libName string, values []*compiler.Value) { func printValuesText(iw io.Writer, libName string, values []*compiler.Value) {
fmt.Fprintf(iw, "\n%sInputs:\n", textPadding)
w := tabwriter.NewWriter(iw, 0, 4, len(textPadding), ' ', 0) w := tabwriter.NewWriter(iw, 0, 4, len(textPadding), ' ', 0)
for _, i := range values { for _, i := range values {
docStr := terminalTrim(common.ValueDocString(i)) docStr := terminalTrim(common.ValueDocString(i))
@ -261,6 +260,7 @@ func PrintDoc(ctx context.Context, w io.Writer, packageName string, val *compile
fmt.Fprintf(w, "\n%sInputs: none\n", textPadding) fmt.Fprintf(w, "\n%sInputs: none\n", textPadding)
break break
} }
fmt.Fprintf(w, "\n%sInputs:\n", textPadding)
printValuesText(w, name, inp) printValuesText(w, name, inp)
case markdownFormat: case markdownFormat:
fmt.Fprintf(w, "#### %s Inputs\n\n", mdEscape(name)) fmt.Fprintf(w, "#### %s Inputs\n\n", mdEscape(name))
@ -281,6 +281,7 @@ func PrintDoc(ctx context.Context, w io.Writer, packageName string, val *compile
fmt.Fprintf(w, "\n%sOutputs: none\n", textPadding) fmt.Fprintf(w, "\n%sOutputs: none\n", textPadding)
break break
} }
fmt.Fprintf(w, "\n%sOutputs:\n", textPadding)
printValuesText(w, name, out) printValuesText(w, name, out)
case markdownFormat: case markdownFormat:
fmt.Fprintf(w, "#### %s Outputs\n\n", mdEscape(name)) fmt.Fprintf(w, "#### %s Outputs\n\n", mdEscape(name))