def setup(self) -> None: self.tmux_proc = start_tmux(tmux_spec_socket, self.win_width, self.win_height, self.tmux_in_terminal()) self.tmux = Tmux.cons(tmux_spec_socket) self._wait(.2) cmd = TmuxIO.read('list-clients -F "#{client_name}"') self.tmux_client = cmd.unsafe(self.tmux).head.get_or_fail('no clients')
def setup_test_tmux(config: TestConfig) -> Tuple[subprocess.Popen, str, Tmux]: tmux_proc = start_tmux(config.socket, config.win_width, config.win_height, config.terminal) tmux = Tmux.cons(tmux_spec_socket) time.sleep(.2) cmd = TmuxIO.read('list-clients -F "#{client_name}"') tmux_client = cmd.unsafe(tmux).head.get_or_fail('no clients') return tmux_proc, tmux_client, tmux
def simple_tmux_cmd_attrs(cmd: str, args: List[str], attrs: List[str]) -> Do: output = yield TmuxIO.read(cmd, '-F', tmux_fmt_attrs(attrs), *args) yield TmuxIO.pure(output / L(tmux_attr_map)(attrs, _))
def capture_pane(id: int) -> Do: output = yield TmuxIO.read(*pane_cmd(id, 'capture-pane', '-p')) yield TmuxIO.pure(output.reversed.drop_while(_ == '').reversed)
def read(self, cmd: str, *args: str) -> 'TmuxIOState[S, A]': return TS.lift(TmuxIO.read(cmd, *args))