Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
cmd/cue/cmd: fix export status and output
Browse files Browse the repository at this point in the history
Fixes #218.

Change-Id: Ib76e07bab60499220712d50df97118ff3033f837
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/4360
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
rogpeppe authored and mpvl committed Dec 10, 2019
1 parent f81c40b commit 27b9ca3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/cue/cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
package cmd

import (
"cuelang.org/go/pkg/encoding/yaml"
"encoding/json"
"fmt"
"io"

"cuelang.org/go/cue"
"cuelang.org/go/pkg/encoding/yaml"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -128,7 +128,7 @@ func outputJSON(cmd *Command, w io.Writer, v cue.Value) error {
if x, ok := err.(*json.MarshalerError); ok {
err = x.Err
}
fmt.Fprintln(w, err)
return err
}
return nil
}
Expand Down
7 changes: 5 additions & 2 deletions cmd/cue/cmd/testdata/script/export_err.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
cue export ./exporterr
! cue export ./exporterr
cmp stdout expect-stdout
cmp stderr expect-stderr
-- expect-stderr --
a.b.2.c: cue: marshal error at path a.b.2.c: cannot convert incomplete value "int" to JSON:
./exporterr/export_err.cue:4:16
-- expect-stdout --
cue: marshal error at path a.b.2.c: cannot convert incomplete value "int" to JSON
-- exporterr/export_err.cue --
package exporterr

Expand Down

0 comments on commit 27b9ca3

Please sign in to comment.