Updated init command to use sh, now resets to startup session
This commit is contained in:
parent
0ae682ef8b
commit
c60129a190
|
@ -70,7 +70,7 @@ fn resolve_link(path: &PathBuf) -> PathBuf {
|
|||
|
||||
fn gather_hm_sessions(path: &PathBuf) -> Vec<Session> {
|
||||
let generation = resolve_link(path);
|
||||
let mut sessions = vec![gather_session_data(&generation)];
|
||||
let mut sessions = vec![gather_session_data(&generation, &generation)];
|
||||
|
||||
sessions.append(&mut gather_specialisations(&generation));
|
||||
|
||||
|
@ -87,7 +87,7 @@ fn gather_specialisations(path: &PathBuf) -> Vec<Session> {
|
|||
.unwrap()
|
||||
.flatten()
|
||||
.map(|entry| {
|
||||
let path = resolve_link(&entry.path());
|
||||
let link_path = resolve_link(&entry.path());
|
||||
// let name = entry
|
||||
// .path()
|
||||
// .file_name()
|
||||
|
@ -96,19 +96,20 @@ fn gather_specialisations(path: &PathBuf) -> Vec<Session> {
|
|||
// .unwrap()
|
||||
// .to_owned();
|
||||
// Session { name, path }
|
||||
gather_session_data(&path)
|
||||
gather_session_data(&link_path, path)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn gather_session_data(path: &PathBuf) -> Session {
|
||||
fn gather_session_data(path: &PathBuf, reset_path: &PathBuf) -> Session {
|
||||
let session_path = path.join("session");
|
||||
|
||||
let name = read_to_string(session_path.join("name")).unwrap();
|
||||
let init = format!(
|
||||
"{} && {}",
|
||||
"sh -c \"{} && {} && {}\"",
|
||||
path.join("activate").display(),
|
||||
session_path.join("init").display()
|
||||
session_path.join("init").display(),
|
||||
reset_path.join("activate").display()
|
||||
);
|
||||
|
||||
Session { name, init }
|
||||
|
|
Loading…
Reference in New Issue