config.Workspace.from_file
Rust
- Python Unavailable
- Ruby Unavailable
- Lua Unavailable
- TypeScript Unavailable
- Rust
- Go Unavailable
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
-
Read and parse one workspace file, as
tmuxp loaddoes.Everything
Self::from_yamlsays holds, except that a start directory beginning withand inheriting none is relative to the file's directory. JSON is read too, as the YAML it is a subset of.Errors
Returns
ConfigError::Readwhen the file cannot be read, and otherwise whatSelf::from_yamlreturns.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()));