hypha: implement attach option on launch to connect to console

This commit is contained in:
Alex Zenla 2024-02-01 10:44:12 +00:00
parent cbfac5cdf4
commit 3a04a2fe26
No known key found for this signature in database
GPG Key ID: 067B238899B51269

View File

@ -31,6 +31,8 @@ enum Commands {
config_bundle: Option<String>, config_bundle: Option<String>,
#[arg[short, long]] #[arg[short, long]]
env: Option<Vec<String>>, env: Option<Vec<String>>,
#[arg(short, long)]
attach: bool,
#[arg()] #[arg()]
image: String, image: String,
#[arg(allow_hyphen_values = true, trailing_var_arg = true)] #[arg(allow_hyphen_values = true, trailing_var_arg = true)]
@ -71,6 +73,7 @@ fn main() -> Result<()> {
cpus, cpus,
mem, mem,
config_bundle, config_bundle,
attach,
env, env,
run, run,
} => { } => {
@ -87,6 +90,9 @@ fn main() -> Result<()> {
if run.is_empty() { None } else { Some(run) }, if run.is_empty() { None } else { Some(run) },
)?; )?;
println!("launched container: {}", uuid); println!("launched container: {}", uuid);
if attach {
controller.console(&uuid.to_string())?;
}
} }
Commands::Destroy { container } => { Commands::Destroy { container } => {