'Run a previous command.'

def do_history(self, arg):

    self.cmdhistory.pop()
    if (len(arg) == 0):
        history = {'items': enumerate(self.cmdhistory)}
        self.io.print_history(history)
    else:
        try:
            index = int(arg)
        except ValueError:
            self.io.print_error('Bad    history    index')
            return
        try:
            self.cmdqueue.append(self.cmdhistory[index])
        except IndexError:
            maxIndex = (len(self.cmdhistory) - 1)
            self.io.print_error(('History    index    out    of    range    [0    :    %d]' % maxIndex))
