use anyhow::Result;
use arcbox_connect::v1::MachineExecRequest;
use arcbox_core::vm_lifecycle::DEFAULT_MACHINE_NAME;
use clap::Args;
#[derive(Args)]
pub struct DebugArgs {
pub container: String,
#[arg(trailing_var_arg = true)]
pub command: Vec<String>,
}
pub async fn execute(args: DebugArgs) -> Result<()> {
let command = if args.command.is_empty() {
vec!["/bin/sh".to_string()]
} else {
args.command
};
super::machine::exec_session_interactive(MachineExecRequest {
id: DEFAULT_MACHINE_NAME.to_owned(),
container: args.container,
cmd: command,
..Default::default()
})
.await
}