Querying and filtering
Server.HasSessionAsync checks whether a session exists. It does not return
a selected session object. The complete program checks work, reports its
absence and leaves the borrowed server running. Use collection filtering when
you need handles or must detect several matching objects.
Require exactly one match¶
Attaching to tmux provides the complete C# program
and its setup. It searches an existing server for work, prints the name and
reports an absent session. Its launcher checks that the server remains running.
For a more general predicate, decide whether zero or several results are valid before indexing a collection. Keep lookup and command failures visible: another client can change the server between a read and the operation using its result.
Declarative filters¶
Filtering and queries describes this port’s query APIs, accepted fields and result-count contracts. Use that contract when storing a query in configuration.
Case-insensitive matching¶
Choose case handling explicitly when your query needs it. The attach program
uses exact case because the intended session is named work.
Push the filter into tmux, or read once and filter locally¶
A tmux-side filter reduces returned rows; a captured collection can answer several local queries from one read. Neither reserves the result. Check unexpectedly empty format values before assuming that an object does not exist.