#!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
# -*- mode: python; make-backup-files: nil -*-

"""dump3ds [options] <3dsfile>"""

import sys
import optparse
import Dice3DS.dom3ds


def main():
    parser = optparse.OptionParser(
        usage=__doc__,
        version=".".join([str(x) for x in Dice3DS.version]))
    parser.add_option("-l","--arraylines",
                      type="int",default=10,dest="arraylines",
                      help="how many lines of arrays to dump (-1 = all)")
    parser.add_option("-t","--tight",
                      action="store_true",default=False,dest="tight",
                      help="tighten error checking")
    parser.add_option("-e","--exception",
                      action="store_false",default=True,dest="recover",
                      help="don't try to recover from errors; raise exception")
    options,args = parser.parse_args()
    if len(args) != 1:
        parser.error("there must be exactly one position argument")
    Dice3DS.dom3ds.dump_3ds_file(args[0],sys.stdout,options.arraylines,
                                 options.tight,options.recover)


if __name__ == '__main__':
    main()
