'Execute an user command.'

def _HandleCommand(self, cmd, args):

    if ((cmd == 'stop') or (cmd == 'exit')):
        return False
    elif (cmd == 'servers'):
        self._ShowServers()
    elif (cmd == 'help'):
        self._Help()
    elif (cmd == 'ranges'):
        self._ShowRanges()
    elif (cmd == 'rebalance'):
        self._Rebalance()
    elif (cmd == 'recover'):
        if (len(args) != 1):
            print 'Syntax:    recover    <transaction-id>'
        self._Recover(args[0])
    elif (cmd == 'addserver'):
        if (len(args) != 2):
            print 'Syntax:    addserver    <address>    <port>'
        try:
            self._AddServer(args[0], int(args[1]))
        except ValueError:
            print ('Invalid    port    number:    %s' % args[1])
    elif (cmd == 'dropserver'):
        if (len(args) != 2):
            print 'Syntax:    dropserver    <address>    <port>'
        try:
            self._DropServer(args[0], int(args[1]))
        except ValueError:
            print ('Invalid    port    number:    %s' % args[1])
    elif (cmd == 'remserver'):
        if (len(args) != 2):
            print 'Syntax:    remserver    <address>    <port>'
        try:
            self._RemServer(args[0], int(args[1]))
        except ValueError:
            print ('Invalid    port    number:    %s' % args[1])
    elif (cmd == 'sync'):
        self._Sync()
    else:
        print 'No    such    command:', cmd
    return True
