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> { | fn gather_hm_sessions(path: &PathBuf) -> Vec<Session> { | ||||||
|     let generation = resolve_link(path); |     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)); |     sessions.append(&mut gather_specialisations(&generation)); | ||||||
| 
 | 
 | ||||||
| @ -87,7 +87,7 @@ fn gather_specialisations(path: &PathBuf) -> Vec<Session> { | |||||||
|         .unwrap() |         .unwrap() | ||||||
|         .flatten() |         .flatten() | ||||||
|         .map(|entry| { |         .map(|entry| { | ||||||
|             let path = resolve_link(&entry.path()); |             let link_path = resolve_link(&entry.path()); | ||||||
|             // let name = entry
 |             // let name = entry
 | ||||||
|             //     .path()
 |             //     .path()
 | ||||||
|             //     .file_name()
 |             //     .file_name()
 | ||||||
| @ -96,19 +96,20 @@ fn gather_specialisations(path: &PathBuf) -> Vec<Session> { | |||||||
|             //     .unwrap()
 |             //     .unwrap()
 | ||||||
|             //     .to_owned();
 |             //     .to_owned();
 | ||||||
|             // Session { name, path }
 |             // Session { name, path }
 | ||||||
|             gather_session_data(&path) |             gather_session_data(&link_path, path) | ||||||
|         }) |         }) | ||||||
|         .collect() |         .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 session_path = path.join("session"); | ||||||
| 
 | 
 | ||||||
|     let name = read_to_string(session_path.join("name")).unwrap(); |     let name = read_to_string(session_path.join("name")).unwrap(); | ||||||
|     let init = format!( |     let init = format!( | ||||||
|         "{} && {}", |         "sh -c \"{} && {} && {}\"", | ||||||
|         path.join("activate").display(), |         path.join("activate").display(), | ||||||
|         session_path.join("init").display() |         session_path.join("init").display(), | ||||||
|  |         reset_path.join("activate").display() | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     Session { name, init } |     Session { name, init } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jan-Bulthuis
						Jan-Bulthuis