#!/usr/bin/python
#
# Copyright (C) 2005, TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
#

import sys

from pisi.cli.pisicli import PisiCLI
from pisi.ui import ui

def handleException(exception, value, tb):
    import traceback
    import exceptions

    if exception == exceptions.KeyboardInterrupt:
        ui.error("\nKeyboardInterrupt: Exiting...\n")
        sys.exit(1)

    ui.error("""
Internal PISI Error:
Please file a bug report! (http://bugs.uludag.org.tr)

""")

    ui.error("%s\n" %value)
    ui.info("Traceback:\n")
    traceback.print_tb(tb)
    sys.exit(1)

if __name__ == "__main__":

    sys.excepthook = handleException

    cli = PisiCLI()
    cli.runCommand()
        
