From 396f85c1866945f718763f269aed2fa5f0dfe099 Mon Sep 17 00:00:00 2001 From: Sergio Lopez Date: Tue, 16 Aug 2022 17:44:05 +0200 Subject: [PATCH 1/2] Restrict the number of values of "-p" and "-v" With clap, "multiple(true)" implies that an argument may appear more than once, but also that each time can declare multiple values. This behavior clobbers the positional argument IMAGE. To prevent this, declare a limit of 1 value per occurrence. Fixes: #32 Signed-off-by: Sergio Lopez --- src/main.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index fc718c0..58d0428 100644 --- a/src/main.rs +++ b/src/main.rs @@ -195,7 +195,8 @@ fn main() { .short("v") .help("Volume in form \"host_path:guest_path\" to be exposed to the guest") .takes_value(true) - .multiple(true), + .multiple(true) + .number_of_values(1), ) .arg( Arg::with_name("remove-ports") @@ -208,7 +209,8 @@ fn main() { .short("p") .help("Port in format \"host_port:guest_port\" to be exposed to the host") .takes_value(true) - .multiple(true), + .multiple(true) + .number_of_values(1), ) .arg( Arg::with_name("new-name") @@ -279,7 +281,8 @@ fn main() { .short("v") .help("Volume in form \"host_path:guest_path\" to be exposed to the guest") .takes_value(true) - .multiple(true), + .multiple(true) + .number_of_values(1), ) .arg( Arg::with_name("port") @@ -287,7 +290,8 @@ fn main() { .short("p") .help("Port in format \"host_port:guest_port\" to be exposed to the host") .takes_value(true) - .multiple(true), + .multiple(true) + .number_of_values(1), ) .arg( Arg::with_name("name") From f9f4d4f5cca95f092d72bbda563423d89a0d9717 Mon Sep 17 00:00:00 2001 From: Sergio Lopez Date: Tue, 16 Aug 2022 17:52:10 +0200 Subject: [PATCH 2/2] Bump version to v0.2.2 This version just contains a minor fix in the way arguments are parsed, bump release number to v0.2.2 Signed-off-by: Sergio Lopez --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c88dbd7..76aec36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -161,7 +161,7 @@ dependencies = [ [[package]] name = "krunvm" -version = "0.2.1" +version = "0.2.2" dependencies = [ "clap", "confy", diff --git a/Cargo.toml b/Cargo.toml index f82c203..6d0765b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "krunvm" -version = "0.2.1" +version = "0.2.2" authors = ["Sergio Lopez "] description = "Create microVMs from OCI images" repository = "https://github.com/containers/krunvm"