From 2880e84c684b23c3b5a523be55b4f88787defbb9 Mon Sep 17 00:00:00 2001 From: Albin Kerouanton Date: Mon, 18 Nov 2024 01:17:58 +0100 Subject: [PATCH] Support overriding config's command through CLI args Commit ab25958 added support for oneliners, but it marked the 'command' arg as conflicting with the 'config' arg. This prevents using a config file with `go run|test -exec`. Moreover, having a way to override the command defined in the config file gives an easy way to exec into a VM to manually debug a failing command. Signed-off-by: Albin Kerouanton --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 49177a6..11362c4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -45,7 +45,6 @@ struct Args { #[clap(short, long, conflicts_with = "config")] qemu_command: Option, /// Command to run in kernel mode. `-` to get an interactive shell. - #[clap(conflicts_with = "config")] command: Vec, } @@ -135,6 +134,13 @@ fn config(args: &Args) -> Result { .target .into_iter() .filter(|t| filter.is_match(&t.name)) + .map(|t| { + let mut t = t; + if !args.command.is_empty() { + t.command = args.command.join(" "); + } + t + }) .collect::>(); let base = config_path.parent().unwrap(); Vmtest::new(base, config)