Core LibraryalphaAPI Reference

Choose documentation 1

latest

Current version

latest
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

function libtmux-elixir latest

Selection.where/2

Filters validated data while retaining order and captured graph context.

Source and package
Qualified name
LibTmux.Selection.where/2
Module
LibTmux
Declared in
Selection
Package
libtmux
Source
lib/libtmux/selection.ex

Examples#

One pane must satisfy both conditions inside some. Window @0 has an active shell and an inactive editor; only @1 has an active editor. See filtering for the complete semantics.

iex> alias LibTmux.{Selection, Snapshot}
iex> rows = %{window: [%{id: "@0"}, %{id: "@1"}], pane: [
...> %{id: "%0", window_id: "@0", active: true, current_command: "bash"},
...> %{id: "%1", window_id: "@0", active: false, current_command: "nvim"},
...> %{id: "%2", window_id: "@1", active: true, current_command: "nvim"}]}
iex> {:ok, snapshot} = Snapshot.new(rows,
...> server_instance: "example", captured_from: 0, captured_until: 0,
...> complete: [:pane], fields: %{pane: [:window_id, :active, :current_command]})
iex> snapshot |> Snapshot.windows()
...> |> Selection.where(panes: [some: [active: true, current_command: "nvim"]])
...> |> Enum.map(& &1.id)
["@1"]
Type parameters
Parameters

Discussed in Capture a pane and read it · Getting started

Esc

Type to search.

Reference preview Open reference