# Path: shimehari/core/exceptions.py
# class CommandError(Exception):
#     def __init__(self, description):
#         self.description = description
# 
#     def __str__(self):
#         return 'CommandError: %s' % self.description
# 
# class DrinkError(Exception):
#     def __init__(self, description, host='127.0.0.1', port=5959):
#         self.description = description
#         self.host = host
#         self.port = port
# 
#     def __str__(self):
#         return 'Shimehari Drink Command is Error: %s\nhost=%s\nport=%d' % (self.description, self.host, self.port)


import sys
import traceback
import shimehari
import os
from optparse import OptionParser, make_option
from shimehari.core.exceptions import CommandError, DrinkError
        make_option('--traceback', action='store_true', help='Print traceback on exception'),
    )

    def __init__(self):
        self.parser = OptionParser(
            usage=self.usage,
            prog='shimehari %s' % self.name,
            version=self.getVersion(),
            option_list=self.option_list)
        if not self.name is None:
            command_dict[self.name] = self

    def getVersion(self):
        return shimehari.getVersion()

    def runFromArgv(self, argv):
        options, args = self.parser.parse_args(argv[2:])
        self.execute(*args, **options.__dict__)

    def execute(self, *args, **options):

        showTraceback = options.get('traceback', False)

        try:
            self.stdout = options.get('stdout', sys.stdout)
            self.stderror = options.get('stderr', sys.stderr)

            output = self.handle(*args, **options)
            if output:
                self.stdout.write(output)

# Path: shimehari/core/exceptions.py
# class CommandError(Exception):
#     def __init__(self, description):
#         self.description = description
# 
#     def __str__(self):
#         return 'CommandError: %s' % self.description
# 
# class DrinkError(Exception):
#     def __init__(self, description, host='127.0.0.1', port=5959):
#         self.description = description
#         self.host = host
#         self.port = port
# 
#     def __str__(self):
#         return 'Shimehari Drink Command is Error: %s\nhost=%s\nport=%d' % (self.description, self.host, self.port)


# Path: shimehari/core/manage/AbstractCommand.py
import sys
import traceback
import shimehari
import os
from optparse import OptionParser, make_option
from shimehari.core.exceptions import CommandError, DrinkError

        make_option('--traceback', action='store_true', help='Print traceback on exception'),
    )

    def __init__(self):
        self.parser = OptionParser(
            usage=self.usage,
            prog='shimehari %s' % self.name,
            version=self.getVersion(),
            option_list=self.option_list)
        if not self.name is None:
            command_dict[self.name] = self

    def getVersion(self):
        return shimehari.getVersion()

    def runFromArgv(self, argv):
        options, args = self.parser.parse_args(argv[2:])
        self.execute(*args, **options.__dict__)

    def execute(self, *args, **options):

        showTraceback = options.get('traceback', False)

        try:
            self.stdout = options.get('stdout', sys.stdout)
            self.stderror = options.get('stderr', sys.stderr)

            output = self.handle(*args, **options)
            if output:
                self.stdout.write(output)

        except (TypeError, CommandError, DrinkError), e: