noms show should stream to stdout (#1456)

This commit is contained in:
Erik Arvidsson
2016-05-06 18:15:52 -07:00
committed by Aaron Boodman
parent 1616e39373
commit e2f7776614
2 changed files with 8 additions and 1 deletions

View File

@@ -38,6 +38,7 @@ func main() {
database, value, err := spec.Value()
util.CheckError(err)
fmt.Println(types.EncodedValueWithTags(value))
types.WriteEncodedValueWithTags(os.Stdout, value)
fmt.Fprintf(os.Stdout, "\n")
database.Close()
}

View File

@@ -255,3 +255,9 @@ func EncodedValueWithTags(v Value) string {
w.WriteTagged(v)
return buf.String()
}
// WriteEncodedValueWithTags writes the serialization of a value prefixed by its type.
func WriteEncodedValueWithTags(w io.Writer, v Value) {
hrs := &hrsWriter{w: w}
hrs.WriteTagged(v)
}