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

src.WorkspaceBuilder.plan

Rust
  • Python Unavailable
  • TypeScript Unavailable
  • Rust
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

API reference · Markdown

src.WorkspaceBuilder.plan ( self , workspace : &Workspace ) → Plan
method [source]
method [source]
src.WorkspaceBuilder.plan

Describe what building this workspace would do, without doing it.

The returned plan is inert, so a caller can render it, count what it costs, or explain it before anything reaches tmux. Every object a later step addresses is a forward reference to the step that makes it, so the whole file lowers without a single round trip to look an id up.

Examples

use tmux_workspace::{Workspace, WorkspaceBuilder};
let workspace = Workspace::from_yaml(
"
session_name: dev
windows:
- window_name: editor
panes:
- vim
",
)?;
let server = libtmux::Server::builder()
.socket_path("/tmp/libtmux-rs-test/plan-example.sock")
.build()?;
let plan = WorkspaceBuilder::new(&server).plan(&workspace);
// Nothing has run, but the first command is already known.
assert!(plan.preview()[0]
.as_ref()
.is_some_and(|command| command.summary().to_string().contains("new-session")));

Discussed in Control mode vs one-shot · Use the Rust workspace builder , Rust workspace builder behavior , Rust workspace builder API

Esc

Type to search.