runtime: separate workspace pod and profile identity
This commit is contained in:
+14
-3
@@ -33,11 +33,13 @@ use client::PodRuntimeCommand;
|
||||
pub struct LaunchOptions {
|
||||
pub mode: LaunchMode,
|
||||
pub runtime_command: PodRuntimeCommand,
|
||||
pub workspace_root: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum LaunchMode {
|
||||
Spawn {
|
||||
pod_name: Option<String>,
|
||||
profile: Option<String>,
|
||||
},
|
||||
/// `yoi <name>` / `yoi --pod <name>`: attach to a live Pod by name if
|
||||
@@ -61,8 +63,17 @@ pub async fn launch(options: LaunchOptions) -> ExitCode {
|
||||
let LaunchOptions {
|
||||
mode,
|
||||
runtime_command,
|
||||
workspace_root,
|
||||
} = options;
|
||||
|
||||
if let Err(e) = std::env::set_current_dir(&workspace_root) {
|
||||
eprintln!(
|
||||
"yoi: failed to enter workspace {}: {e}",
|
||||
workspace_root.display()
|
||||
);
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
|
||||
if let Err(e) = enable_raw_mode() {
|
||||
eprintln!("yoi: failed to enter raw mode: {e}");
|
||||
return ExitCode::FAILURE;
|
||||
@@ -74,8 +85,8 @@ pub async fn launch(options: LaunchOptions) -> ExitCode {
|
||||
}
|
||||
|
||||
let result = match mode {
|
||||
LaunchMode::Spawn { profile } => {
|
||||
single_pod::run_spawn(None, profile, runtime_command).await
|
||||
LaunchMode::Spawn { pod_name, profile } => {
|
||||
single_pod::run_spawn(None, pod_name, profile, runtime_command).await
|
||||
}
|
||||
LaunchMode::PodName {
|
||||
pod_name,
|
||||
@@ -83,7 +94,7 @@ pub async fn launch(options: LaunchOptions) -> ExitCode {
|
||||
} => single_pod::run_pod_name(pod_name, socket_override, runtime_command).await,
|
||||
LaunchMode::Resume => single_pod::run_resume(runtime_command).await,
|
||||
LaunchMode::ResumeWithSession(id) => {
|
||||
single_pod::run_spawn(Some(id), None, runtime_command).await
|
||||
single_pod::run_spawn(Some(id), None, None, runtime_command).await
|
||||
}
|
||||
LaunchMode::Panel => single_pod::run_panel(runtime_command).await,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user