def __str__(self):
        """
        Display current commands
        """

        string = ""
        mergelist = []
        if len(self.cmdset_stack) > 1:
            # We have more than one cmdset in stack; list them all
            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"

        # Display the currently active cmdset, limited by self.obj's permissions
        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()
dataset/ETHPy150Open evennia/evennia/evennia/commands/cmdsethandler.py/CmdSetHandler.__str__/original