示例#1
0
文件: main.py 项目: tek/chiasma-py
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)))
示例#2
0
文件: main.py 项目: tek/chiasma-py
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)
示例#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))
示例#4
0
文件: state.py 项目: tek/chiasma-py
 def from_either_state(self, st: EitherState[E, S,
                                             A]) -> 'TmuxIOState[S, A]':
     return st.transform_f(TmuxIOState, lambda s: TmuxIO.from_either(s))
示例#5
0
文件: state.py 项目: tek/chiasma-py
 def from_either(self, e: Either[str, A]) -> 'TmuxIOState[S, A]':
     return TmuxIOState.lift(TmuxIO.from_either(e))
示例#6
0
文件: state.py 项目: tek/chiasma-py
 def inspect_either(
         self, f: Callable[[S], Either[str, A]]) -> 'TmuxIOState[S, A]':
     return TmuxIOState.inspect_f(lambda s: TmuxIO.from_either(f(s)))