summaryrefslogtreecommitdiff
path: root/nbt/nbtdump/main.go
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-08-07 11:19:57 +0200
committerKevin Chabowski <kevin@kch42.de>2013-08-07 11:19:57 +0200
commite9436211924b03993c6272069d10a917578b1a52 (patch)
tree724d45dd1135016cead3474ac3c518334cd24361 /nbt/nbtdump/main.go
parent8df0e89ed596504a23dd843ac44b6ab454816eb1 (diff)
downloadgonbt-e9436211924b03993c6272069d10a917578b1a52.tar.gz
gonbt-e9436211924b03993c6272069d10a917578b1a52.tar.bz2
gonbt-e9436211924b03993c6272069d10a917578b1a52.zip
Stringer interface implemented for Tag.
Also added a small test tool which reads NBT data from stdin and put the stringified data to stdout.
Diffstat (limited to 'nbt/nbtdump/main.go')
-rw-r--r--nbt/nbtdump/main.go18
1 files changed, 18 insertions, 0 deletions
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)
+}