config.Workspace.from_file
This type appears in public signatures. It is not a package entry point.
-
Read and parse one workspace file, as
tmuxp loaddoes.Description#
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::Readwhen the file cannot be read, and otherwise whatSelf::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: ./\nwindows: []\n")?;let workspace = Workspace::from_file(&file)?;assert_eq!(workspace.start_directory.as_deref(), Some(project.path()));