Selection.one
The single member, or the single one matching criteria.
Source and package
- Qualified name
-
Selection.one - Module
- selection
- Declared in
Selection- Package
- libtmux
- Source
- packages/libtmux/src/selection.ts
-
Description#
Throws
NoMatchErrorfor none andMultipleMatchesErrorfor several, so "exactly one" is enforced rather than assumed — afirst()that silently takes the head of two is how the wrong pane gets driven.An id is not always one member. A window linked into two sessions, or shared by two grouped sessions, has a placement in each and both carry the same id, so
one({ id })raises for a perfectly good id. Add the session to say which placement is meant.Examples#
const only = snapshot.sessions.one({ name: "work" });only.id;
Guides#
Pages that discuss one.
- Concepts
- Guides