def execute_watcher_start_stop_restart(command, arbiter, props,
                                       watcher_function_name,
                                       watchers_function, arbiter_function):
    if 'name' in props:
        match = props.get('match', 'glob')
        if match == 'simple':
            watchers = [command._get_watcher(arbiter, props['name'])]
        else:
            watcher_name = props['name'].lower()
            if match == 'glob':
                name = re.compile(fnmatch.translate(watcher_name))
            elif match == 'regex':
                name = re.compile(watcher_name)
            else:
                raise MessageError("unknown match method %s" % match)
            watchers = [watcher
                        for watcher in arbiter.iter_watchers()
                        if name.match(watcher.name.lower())]

        if not watchers:
            raise MessageError("program %s not found" % props['name'])

        if len(watchers) == 1:
            if props.get('waiting'):
                resp = TransformableFuture()
                func = getattr(watchers[0], watcher_function_name)
                resp.set_upstream_future(func())
                resp.set_transform_function(lambda x: {"info": x})
                return resp
            return getattr(watchers[0], watcher_function_name)()

        def watcher_iter_func(reverse=True):
            return sorted(watchers, key=lambda a: a.priority, reverse=reverse)

        return watchers_function(watcher_iter_func=watcher_iter_func)
    else:
        return arbiter_function()
Set cursor position.
dataset/ETHPy150Open circus-tent/circus/circus/commands/restart.py/execute_watcher_start_stop_restart--crossover with--dataset/ETHPy150Open wkentaro/conque.vim/autoload/conque_term/conque_screen.py/ConqueScreen.set_cursor