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

config.Workspace.from_file

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

API reference · Markdown

config.Workspace.from_file ( path : impl AsRef<Path> ) → Result<Self, ConfigError>
method [source]
method [source]
config.Workspace.from_file

Read and parse one workspace file, as tmuxp load does.

Everything Self::from_yaml says holds, except that a start directory beginning with and inheriting none is relative to the file's directory. JSON is read too, as the YAML it is a subset of.

Errors

Returns ConfigError::Read when the file cannot be read, and otherwise what Self::from_yaml returns.

Examples

use tmux_workspace::Workspace;
let project = tempfile::tempdir()?;
let file = project.path().join(".tmuxp.yaml");
std::fs::write(&file, "session_name: project\nstart_directory: ./\n")?;
let workspace = Workspace::from_file(&file)?;
assert_eq!(workspace.start_directory.as_deref(), Some(project.path()));
Esc

Type to search.