Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions libtmux-kotlin/src/main/kotlin/io/github/libtmux/kotlin/Server.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,47 +42,67 @@ import io.github.libtmux.Window as JavaWindow
* [control] attaches a control client, whose output and events arrive as cold `Flow`s, and
* [withControl] scopes one to a block. [close] releases what the server owns.
*
* [open], [withServer], [fromJava], [config], [identity], [version], [isAlive], [requireAlive],
* [admissionBound], [policy], [control], [withControl] and [close]
*
* **Finding one thing.** Given a filter, [session], [window], and [pane] throw unless exactly one
* object matches, and [sessionOrNull], [windowOrNull], and [paneOrNull] return null when none does;
* several matches throw either way. [session] by name or `SessionId`, [pane] by `PaneId`, and
* [window] by `WindowContext` return null when tmux does not have it. [hasSession] answers by name
* without returning the session.
*
* [session], [window], [pane], [sessionOrNull], [windowOrNull], [paneOrNull] and [hasSession]
*
* **Listing everything.** [sessions], [windows], [panes], [clients], and [attachedSessions] each
* return a `List` captured now. A failed read throws, so an outage does not read as an empty
* server. [windows] also takes a `WindowId` and answers every link to that window. [snapshot]
* captures the whole tree with one listing per kind of object rather than one command per object,
* and [liveState] publishes it again as a `StateFlow` whenever tmux announces a change;
* [withLiveState] scopes that to a block.
*
* [sessions], [windows], [panes], [clients], [attachedSessions], [snapshot], [liveState] and
* [withLiveState]
*
* **Querying things and getting around.** Hand [sessions], [windows], [panes], [session], [window],
* or [pane] a filter built from the field properties on the handle companions, such as
* `Pane.command startsWith "nvim"`, and tmux does the filtering when it can. To move between
* levels, go down with [Session.windows] and [Window.panes], up with [Pane.window] and
* [Window.session], and across to the focused child with [Session.activeWindow] and
* [Window.activePane]. Each is a pure read of the capture, so none suspends or asks tmux again.
*
* [sessions], [windows], [panes], [session], [window], [pane], [Session.windows], [Window.panes],
* [Pane.window], [Window.session], [Session.activeWindow] and [Window.activePane]
*
* **Changing things.** [newSession] creates a detached session from a name, a `SessionSpec`, or a
* builder block, and returns the session tmux made. [killSession] ends a session by name,
* [killServer] ends the tmux server and every session on it, which [close] deliberately does not,
* and [lock] locks every attached client.
*
* [newSession], [killSession], [killServer], [close] and [lock]
*
* **Options and hooks.** [options] holds the server-wide options, [globalOptions] the session
* options every session inherits unless it sets its own, [hooks] the global hooks, and
* [environment] the variables every new process is given. Each returns a wrapper whose own
* operations are `suspend`.
*
* [options], [globalOptions], [hooks] and [environment]
*
* **Everything else tmux keeps.** Paste buffers ([buffers]), key bindings ([keys]), a file of tmux
* commands to run ([sourceFile]), shell commands ([shell]), the command list ([commands]), the
* message log ([messageLog]), prompt history ([prompt]), and wait-for channels ([channel]).
* [expand][Server.expand] expands a format against the server, [variables][Server.variables] reads
* named variables in one expansion, and [paneFields] reads chosen fields of every pane from one
* listing.
*
* Anything tmux can do that is not here is reachable through [cmd], which runs one command and
* hands back its result, [run][Server.run], which throws when tmux reports a nonzero exit, [batch]
* and [chain], which run several in one invocation, or [asJava], for an operation this class does
* not mirror.
* [buffers], [keys], [sourceFile], [shell], [commands], [messageLog], [prompt], [channel],
* [expand][Server.expand], [variables][Server.variables] and [paneFields]
*
* **Running a command.** Anything tmux can do that is not here is reachable through [cmd], which
* runs one command and hands back its result, [run][Server.run], which throws when tmux reports a
* nonzero exit, [batch] and [chain], which run several in one invocation, or [asJava], for an
* operation this class does not mirror.
*
* [cmd], [run][Server.run], [batch], [chain] and [asJava]
*/
public class Server private constructor(
internal val java: JavaServer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,19 @@ import scala.jdk.DurationConverters._
* builder from this server's choices, and [[Server.asJava]] reaches the
* underlying Java server.
*
* [[Server.open]], [[Server.fromJava]], [[config]], [[Server.identity]],
* [[version]], [[isAlive]], [[requireAlive]], [[Server.within]],
* [[admissionBound]], [[Server.control]], [[toBuilder]] and [[Server.asJava]]
*
* **Finding one thing.** [[session]] takes a name, an id, or an expression;
* [[pane]] takes an id or an expression; [[window]] takes an expression or a
* `WindowContext`. Each returns an `Option` that is empty when tmux does not
* have it, and an expression that matches several throws
* `CardinalityException.MultipleMatches`. [[hasSession]] answers by name
* without returning the session.
*
* [[session]], [[pane]], [[window]] and [[hasSession]]
*
* **Listing everything.** [[sessions]], [[windows]], [[panes]], [[clients]],
* and [[attachedSessions]] each return a `Vector` captured now. A failed read
* throws, so an outage does not read as an empty server. [[windows]] also
Expand All @@ -49,6 +55,9 @@ import scala.jdk.DurationConverters._
* command per object, and [[io.github.libtmux.scaladsl.live.LiveView]] keeps
* that tree current as tmux announces changes.
*
* [[sessions]], [[windows]], [[panes]], [[clients]], [[attachedSessions]] and
* [[snapshot]]
*
* **Querying things and getting around.** Build an
* [[io.github.libtmux.scaladsl.query.Expr Expr]] from the fields on the
* `Session`, `Window`, and `Pane` companions, such as
Expand All @@ -60,17 +69,25 @@ import scala.jdk.DurationConverters._
* [[Window.activePane]]. Each is a pure read of the capture, so none asks tmux
* again.
*
* [[sessions]], [[windows]], [[panes]], [[session]], [[window]], [[pane]],
* [[Session.windows]], [[Window.panes]], [[Pane.window]], [[Window.session]],
* [[Session.activeWindow]] and [[Window.activePane]]
*
* **Changing things.** [[newSession]] creates a detached session from a name,
* a callback on a builder, or a `SessionSpec`, and returns the session tmux
* made. [[killSession]] ends a session by name, [[killServer]] ends the tmux
* server and every session on it, which `close()` deliberately does not, and
* [[lock]] locks every attached client.
*
* [[newSession]], [[killSession]], [[killServer]] and [[lock]]
*
* **Options and hooks.** [[options]] holds the server-wide options,
* [[globalOptions]] the session options every session inherits unless it sets
* its own, [[hooks]] the global hooks, and [[environment]] the variables every
* new process is given.
*
* [[options]], [[globalOptions]], [[hooks]] and [[environment]]
*
* **Everything else tmux keeps.** Paste buffers ([[buffers]]), key bindings
* ([[keys]]), a file of tmux commands to run ([[sourceFile]]), shell commands
* ([[shell]]), the command list ([[commands]]), the message log
Expand All @@ -79,10 +96,16 @@ import scala.jdk.DurationConverters._
* reads named variables in one expansion, and [[paneFields]] reads chosen
* fields of every pane from one listing.
*
* Anything tmux can do that is not here is reachable through [[cmd]], which
* runs one command and hands back its result, [[run]], which throws when tmux
* reports a nonzero exit, or [[batch]] and [[chain]], which run several in one
* invocation.
* [[buffers]], [[keys]], [[sourceFile]], [[shell]], [[commands]],
* [[messageLog]], [[prompt]], [[channel]], [[expand]], [[variables]] and
* [[paneFields]]
*
* **Running a command.** Anything tmux can do that is not here is reachable
* through [[cmd]], which runs one command and hands back its result, [[run]],
* which throws when tmux reports a nonzero exit, or [[batch]] and [[chain]],
* which run several in one invocation.
*
* [[cmd]], [[run]], [[batch]] and [[chain]]
*/
opaque type Server <: AutoCloseable = JavaServer

Expand Down
Loading