示例#1
0
文件: setup.py 项目: tek/chromatin.py
def bootstrap_result(result: List[Either[str, str]]) -> Do:
    def split(z: Tuple[List[str], List[Venv]],
              a: Either[str, Venv]) -> Tuple[List[str], List[Venv]]:
        err, vs = z
        return a.cata((lambda e: (err.cat(e), vs)), (lambda v:
                                                     (err, vs.cat(v))))

    errors, venvs = result.fold_left((Nil, Nil))(split)
    ribo_log.debug(f'bootstrapped venvs: {venvs}')
    yield venvs.traverse(add_venv, State).nvim
    yield NS.modify(store_errors(errors))
    yield NS.error(f'failed to setup venvs: {errors.map(str).join_comma}'
                   ) if errors else NS.unit
示例#2
0
def deactivate_by_names(plugins: List[str]) -> Do:
    getter = (lambda a: a.active_rplugins) if plugins.empty else (
        lambda a: a.active_rplugins_by_name(plugins))
    rplugins = yield NS.inspect_either(getter)
    yield (NS.error(resources.no_plugins_match_for_deactivation(plugins))
           if rplugins.empty else deactivate_multi(rplugins))
示例#3
0
def activate_by_names(plugins: List[str]) -> Do:
    getter = (lambda a: a.ready_rplugins) if plugins.empty else (
        lambda a: a.ready_by_name(plugins))
    rplugins = yield Ribo.zoom_main(NS.inspect_either(getter))
    yield (NS.error(resources.no_plugins_match_for_activation(plugins))
           if rplugins.empty else activate_multi(rplugins))