cmd/cue-ast-print: allow reading stdin
It's useful to be able to pipe stdin into this command.
While we're about it, add a proper usage message
and make the output slightly more compact by:
- omitting a newline for empty slices and structs
- omitting the type name when it's implied by an enclosing
slice (as allowed in Go slice literals).
Also avoid the unneeded calls to `reflect.Value.Interface`: the
fmt package will do that automatically for us.
Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I6339c4ef8d0af0f7c567301050a837350cb4de7f
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199601
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>