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.one/2

Returns exactly one match, or a structured cardinality error; stops at the second match.

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

Examples#

iex> alias LibTmux.{Selection, Snapshot}
iex> {:ok, snapshot} = Snapshot.new(%{pane: [%{id: "%0"}, %{id: "%1"}]},
...> server_instance: "example", captured_from: 0, captured_until: 0,
...> fields: %{pane: [:id]})
iex> panes = Snapshot.panes(snapshot)
iex> {:ok, pane} = Selection.one(panes, id: "%1")
iex> pane.id
"%1"
iex> {:error, error} = Selection.one(panes, id: "%9")
iex> error.kind
:no_match
iex> {:error, error} = Selection.one(panes)
iex> error.kind
:multiple_matches
Type parameters
Parameters

Discussed in Observation and filter schema

Esc

Type to search.

Reference preview Open reference