Merge pull request #573 from samalba/fix-inputs-list

Fix inputs / outputs list
This commit is contained in:
Sam Alba 2021-06-07 17:29:51 +02:00 committed by GitHub
commit 2c7c5dc9bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -112,6 +112,10 @@ func FormatValue(val *compiler.Value) string {
if val.IsConcreteR() != nil { if val.IsConcreteR() != nil {
return val.IncompleteKindString() return val.IncompleteKindString()
} }
if val.IncompleteKindString() == "struct" {
return "struct"
}
// value representation in Cue // value representation in Cue
valStr := fmt.Sprintf("%v", val.Cue()) valStr := fmt.Sprintf("%v", val.Cue())
// escape \n // escape \n

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))

View File

@ -17,16 +17,16 @@ import (
// Extra alpine packages to install // Extra alpine packages to install
package: { package: {
[string]: true | false | string @dagger(input) [string]: true | false | string
} } @dagger(input)
// working directory to use // working directory to use
cwd: *"." | string @dagger(input) cwd: *"." | string @dagger(input)
// Environment variables // Environment variables
env: { env: {
[string]: string @dagger(input) [string]: string
} } @dagger(input)
// Write the contents of `environment` to this file, // Write the contents of `environment` to this file,
// in the "envfile" format. // in the "envfile" format.