hypha-agent: command line arguments

This commit is contained in:
Alex Zenla
2024-01-17 12:36:13 -08:00
parent 8af6e25edc
commit f69ce96054
6 changed files with 63 additions and 145 deletions

View File

@ -1,8 +1,26 @@
use clap::Parser;
use hypha::agent::Agent;
use hypha::error::Result;
#[derive(Parser, Debug)]
#[command(version, about)]
struct AgentArgs {
#[arg(short, long)]
kernel: String,
#[arg(short, long)]
initrd: String,
#[arg(short, long, default_value_t = 1)]
cpus: u32,
#[arg(short, long, default_value_t = 512)]
mem: u64,
}
fn main() -> Result<()> {
let mut agent = Agent::new()?;
let args = AgentArgs::parse();
let mut agent = Agent::new(args.kernel, args.initrd, args.cpus, args.mem)?;
let domid = agent.launch()?;
println!("launched domain: {}", domid);
Ok(())