fix: Allow for non-existence of base session
This commit is contained in:
parent
3ca0f333d5
commit
5d290517ee
1 changed files with 12 additions and 9 deletions
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue