Skip to content

Commit 2880e84

Browse files
committed
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 <albinker@gmail.com>
1 parent 80cd7b5 commit 2880e84

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ struct Args {
4545
#[clap(short, long, conflicts_with = "config")]
4646
qemu_command: Option<String>,
4747
/// Command to run in kernel mode. `-` to get an interactive shell.
48-
#[clap(conflicts_with = "config")]
4948
command: Vec<String>,
5049
}
5150

@@ -135,6 +134,13 @@ fn config(args: &Args) -> Result<Vmtest> {
135134
.target
136135
.into_iter()
137136
.filter(|t| filter.is_match(&t.name))
137+
.map(|t| {
138+
let mut t = t;
139+
if !args.command.is_empty() {
140+
t.command = args.command.join(" ");
141+
}
142+
t
143+
})
138144
.collect::<Vec<_>>();
139145
let base = config_path.parent().unwrap();
140146
Vmtest::new(base, config)

0 commit comments

Comments
 (0)