#!/usr/bin/env python
import errno
import logging

from cocaine.tools import printer
from cocaine.tools.dispatcher import d


printer.ENABLE_OUTPUT = True


__author__ = 'EvgenySafronov <division494@gmail.com>'


__doc__ = '''Provides helpful tools for management, viewing, uploading and other actions with cocaine applications
and services'''


log = logging.getLogger('cocaine.tools')


if __name__ == '__main__':
    try:
        d.dispatch()
    except KeyboardInterrupt:
        log.error('Terminated by user')
        exit(errno.ECANCELED)
    except Exception as err:
        log.error('Unknown error occurred - %s', err)
        exit(128)
