#!/usr/bin/python3

from nbt import nbt
from sys import argv

def dump(f, depth=0, prefix="| "):
    for k, v in f.items():
        print(prefix * depth + k + ": ", end="")
        if hasattr(v, "items"):
            print('')
            dump(v, depth+1, prefix)
        elif isinstance(v, list):
            print('')
            dump(dict([(str(i), v[i]) for i in range(len(v))]), depth+1, prefix)
        else:
            if len(str(v)) < 100:
                print(str(v))
            else:
                print(f'<{len(str(v))} bytes data>')
            

for file in argv[1:]:
    dump(nbt(file=file).contents)
    


