diff --git a/rust/forevervm/src/commands/machine.rs b/rust/forevervm/src/commands/machine.rs index 7c0f9cf..0834784 100644 --- a/rust/forevervm/src/commands/machine.rs +++ b/rust/forevervm/src/commands/machine.rs @@ -42,13 +42,13 @@ pub async fn machine_list(tags: std::collections::HashMap) -> an Ok(()) } -pub async fn machine_new(tags: std::collections::HashMap) -> anyhow::Result<()> { +pub async fn machine_new( + tags: std::collections::HashMap, + memory_mb: Option, +) -> anyhow::Result<()> { let client = ConfigManager::new()?.client()?; - let request = CreateMachineRequest { - tags, - memory_mb: None, - }; + let request = CreateMachineRequest { tags, memory_mb }; let machine = client.create_machine(request).await?; println!( diff --git a/rust/forevervm/src/main.rs b/rust/forevervm/src/main.rs index 5f53242..3e2b8eb 100644 --- a/rust/forevervm/src/main.rs +++ b/rust/forevervm/src/main.rs @@ -67,6 +67,10 @@ enum MachineCommands { /// Add tags to the machine in the format key=value #[arg(long = "tag", value_parser = parse_key_val, action = clap::ArgAction::Append)] tags: Option>, + + /// Memory size in MB (if not specified, a default value will be used) + #[arg(long)] + memory_mb: Option, }, /// List all machines List { @@ -95,11 +99,11 @@ async fn main_inner() -> anyhow::Result<()> { whoami().await?; } Commands::Machine { command } => match command { - MachineCommands::New { tags } => { + MachineCommands::New { tags, memory_mb } => { let tags_map = tags .map(|tags| tags.into_iter().collect::>()) .unwrap_or_default(); - machine_new(tags_map).await?; + machine_new(tags_map, memory_mb).await?; } MachineCommands::List { tags } => { let tags_map = tags