#!/usr/bin/env python
# -*- coding: utf-8 -*-
from hy.lang.importer import _hy_import_file

from code import InteractiveConsole
import traceback
import sys

try:
    import readline
except ImportError:
    pass

if len(sys.argv) > 1:
    sys.argv = sys.argv[1:]
    try:
        mod = _hy_import_file(sys.argv[0], '__main__')
    except Exception as e:
        exc_type, exc_value, exc_traceback = sys.exc_info()
        ntb = exc_traceback.tb_next.tb_next.tb_next  # YUCK.
        raise type(e), None, ntb
    sys.exit(0)


InteractiveConsole().interact(banner="""
             "Really, if the lower orders don’t set us a good example, what on
             earth is the use of them?"

              -- Oscar Wilde (The Importance of Being Earnest)


 The hython bits have been loaded -- magically, .hy
 files are importable!""")
