From e9436211924b03993c6272069d10a917578b1a52 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Wed, 7 Aug 2013 11:19:57 +0200 Subject: Stringer interface implemented for Tag. Also added a small test tool which reads NBT data from stdin and put the stringified data to stdout. --- nbt/nbtdump/main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 nbt/nbtdump/main.go (limited to 'nbt/nbtdump') diff --git a/nbt/nbtdump/main.go b/nbt/nbtdump/main.go new file mode 100644 index 0000000..bf9dd9b --- /dev/null +++ b/nbt/nbtdump/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "strconv" + "fmt" + "os" + "github.com/kch42/gonbt/nbt" +) + +func main() { + tag, name, err := nbt.ReadNamedTag(os.Stdin) + if err != nil { + fmt.Fprintf(os.Stderr, "Could not read NBT data: %s", err) + os.Exit(1) + } + + fmt.Printf("Tag Name:\n%s\n\nData:\n%s\n", strconv.Quote(name), tag) +} -- cgit v1.2.3-70-g09d2