'Display current commands'

def __str__(self):

    string = ''
    mergelist = []
    if (len(self.cmdset_stack) > 1):
        for (snum, cmdset) in enumerate(self.cmdset_stack):
            mergetype = self.mergetype_stack[snum]
            permstring = 'non-perm'
            if cmdset.permanent:
                permstring = 'perm'
            if (mergetype != cmdset.mergetype):
                mergetype = ('%s^' % mergetype)
            string += ('\n    %i:    <%s    (%s,    prio    %i,    %s)>:    %s' % (snum, cmdset.key, mergetype, cmdset.priority, permstring, cmdset))
            mergelist.append(str(snum))
        string += '\n'
    mergetype = self.mergetype_stack[(-1)]
    if (mergetype != self.current.mergetype):
        merged_on = self.cmdset_stack[(-2)].key
        mergetype = _("custom    {mergetype}    on    cmdset    '{cmdset}'")
        mergetype = mergetype.format(mergetype=mergetype, cmdset=merged_on)
    if mergelist:
        tmpstring = _('    <Merged    {mergelist}    {mergetype},    prio    {prio}>:    {current}')
        string += tmpstring.format(mergelist='+'.join(mergelist), mergetype=mergetype, prio=self.current.priority, current=self.current)
    else:
        permstring = 'non-perm'
        if self.current.permanent:
            permstring = 'perm'
        tmpstring = _('    <{key}    ({mergetype},    prio    {prio},    {permstring})>:\n    {keylist}')
        string += tmpstring.format(key=self.current.key, mergetype=mergetype, prio=self.current.priority, permstring=permstring, keylist=',    '.join((cmd.key for cmd in sorted(self.current, key=(lambda o: o.key)))))
    return string.strip()
