# This file is part of the Coral project.
# Please read the copyright notice in the LICENSE file.

def main(arguments):
    def usage():
        print "Usage: coral [ --help | --version | filename... ]"
        print "Options:"
        print "  --help         Display this information"
        print "  --version      Display version information and exit"
        print ""
        print "The optional filenames are the XMI files to load on startup"
        print ""

    def version():
        import coral
        print "This is Coral version",coral.version
        
    import sys
    import getopt
    try:
        opts, args = getopt.getopt(arguments, "h", ["help", "version"])
    except getopt.GetoptError:
        usage()
        sys.exit(2)

    for o,a in opts:
        if o in ("-h", "--help"):
            usage()
            sys.exit(0)
        elif o in ("--version"):
            version()
            sys.exit(0)
        else:
            usage()
            sys.exit(2)

    import coral.modeler.modeler
    coral.modeler.modeler.main(args)

if __name__ == "__main__":
    import sys
    main(sys.argv[1:])
