コード例 #1
0
ファイル: cli.py プロジェクト: githubato/sen-arm
def main():
    parser = argparse.ArgumentParser(
        description="Terminal User Interface for Docker Engine"
    )
    exclusive_group = parser.add_mutually_exclusive_group()
    exclusive_group.add_argument("--debug", action="store_true", default=None)

    args = parser.parse_args()

    # if args.debug:
    set_logging(level=logging.DEBUG, path=get_log_file_path())
    # else:
    #     set_logging(level=logging.INFO, path=setup_dirs())

    logger.info("application started")

    try:
        ui = UI()
    except TerminateApplication as ex:
        print("Error: {0}".format(str(ex)), file=sys.stderr)
        return 1

    try:
        ui.run()
    except KeyboardInterrupt:
        print("Quitting on user request.")
        return 1
    except Exception as ex:  # pylint: disable=broad-except
        if args.debug:
            raise
        else:
            logger.error("Exception caught: %r", ex)
            return 1
    return 0
コード例 #2
0
ファイル: cli.py プロジェクト: pabardina/sen
def main():
    parser = argparse.ArgumentParser(
        description="Terminal User Interface for Docker Engine")
    exclusive_group = parser.add_mutually_exclusive_group()
    exclusive_group.add_argument("--debug", action="store_true", default=None)

    args = parser.parse_args()

    # if args.debug:
    set_logging(level=logging.DEBUG, path=get_log_file_path())
    # else:
    #     set_logging(level=logging.INFO, path=setup_dirs())

    logger.info("application started")

    try:
        ui = UI()
    except TerminateApplication as ex:
        print("Error: {0}".format(str(ex)), file=sys.stderr)
        return 1

    try:
        ui.run()
    except KeyboardInterrupt:
        print("Quitting on user request.")
        return 1
    except Exception as ex:  # pylint: disable=broad-except
        if args.debug:
            raise
        else:
            logger.error("Exception caught: %r", ex)
            return 1
    return 0
コード例 #3
0
ファイル: cli.py プロジェクト: pwielgolaski/sen
def main():
    parser = argparse.ArgumentParser(
        description="Terminal User Interface for Docker Engine"
    )
    exclusive_group = parser.add_mutually_exclusive_group()
    exclusive_group.add_argument("--debug", action="store_true", default=None)

    args = parser.parse_args()

    # if args.debug:
    set_logging(level=logging.DEBUG, path=get_log_file_path())
    # else:
    #     set_logging(level=logging.INFO, path=setup_dirs())

    logger.info("application started")

    try:
        ui = UI()
    except TerminateApplication as ex:
        print("Error: {0}".format(str(ex)), file=sys.stderr)
        return 1

    try:
        ui.run()
    except KeyboardInterrupt:
        print("Quitting on user request.")
        return 1
    except Exception as ex:  # pylint: disable=broad-except
        if args.debug:
            raise
        else:
            # TODO: improve this message to be more thorough
            # FIXME: reset terminal and remove all the curses crap
            print("There was an error during program execution, see logs for more info.")
            logger.debug(traceback.format_exc())
            return 1
    return 0