def run(self, edit, command, args=None, text=None, separator=None, items=None):
        try:
            cmd = Command.create(command, args)
            if cmd:
                items = items
                if text: items = text.split(separator)
                cmd.init(self.view, items)
                regions = []
                sel = self.view.sel()
                index = 0
                last_region = None
                for region in sel:
                    if cmd.has_next():
                        value = cmd.next(self.view.substr(region), index, region)
                        if value is not None:
                            self.view.replace(edit, region, value)
                            regions.append(region)
                    else:
                        break
                    last_region = region
                    index += 1
                if not global_settings("keep_selection", False):
                    [sel.subtract(region) for region in regions]
                # add cursor if there is none in the current view
                if len(sel) == 0:
                    sel.add(sublime.Region(last_region.end(), last_region.end()))
                sublime.status_message("Command done: " + command)
            else:
                sublime.error_message("Command not found: " + command)
        except __HOLE__:
            sublime.status_message("Error while executing Text Pastry Command, canceled")
            pass
dataset/ETHPy150Open duydao/Text-Pastry/text_pastry.py/TextPastryCommandWrapperCommand.run