fix: Allow for non-existence of base session

This commit is contained in:
lwad 2024-02-06 16:05:41 +00:00
parent 3ca0f333d5
commit 5d290517ee

View file

@ -85,15 +85,18 @@ pub fn focus_project(projects: &BTreeMap<String, String>, project_name: Option<S
.success();
match has_session {
false => Tmux::with_command(
NewSession::new()
.session_name(&session_name)
.start_directory(&projects[&session_name])
.detached(),
)
.status()
.unwrap()
.success(),
false => {
let base_directory = "~".to_string();
Tmux::with_command(
NewSession::new()
.session_name(&session_name)
.start_directory(projects.get(&session_name).unwrap_or(&base_directory))
.detached(),
)
.status()
.unwrap()
.success()
}
true => true,
};