Exemple #1
0
def pane_dir(pane: P) -> Do:
    ui_pane = yield TmuxIO.from_either(UiPane.e_for(pane))
    yield (ui_pane.cwd(pane) / TmuxIO.pure).get_or(lambda: TmuxIO.from_io(IO.delay(Path.cwd)))
Exemple #2
0
def existing_window(session: Session, window: Window) -> Do:
    sid = yield TmuxIO.from_maybe(session.id, 'session has no id')
    wid = yield TmuxIO.from_maybe(window.id, 'window has no id')
    e = yield session_window(sid, wid)
    yield TmuxIO.from_either(e)
Exemple #3
0
def tmux_data_cmd(cmd: str, args: List[str], cmd_data: TmuxCmdData[A]) -> Do:
    data = yield simple_tmux_cmd_attrs(cmd, args, cmd_data.attrs)
    yield TmuxIO.from_either(cons_tmux_data(data, cmd_data.cons))
Exemple #4
0
 def from_either_state(self, st: EitherState[E, S,
                                             A]) -> 'TmuxIOState[S, A]':
     return st.transform_f(TmuxIOState, lambda s: TmuxIO.from_either(s))
Exemple #5
0
 def from_either(self, e: Either[str, A]) -> 'TmuxIOState[S, A]':
     return TmuxIOState.lift(TmuxIO.from_either(e))
Exemple #6
0
 def inspect_either(
         self, f: Callable[[S], Either[str, A]]) -> 'TmuxIOState[S, A]':
     return TmuxIOState.inspect_f(lambda s: TmuxIO.from_either(f(s)))