Skip to content

Commit 79e715a

Browse files
committed
cli: Prepare for other argv0 dispatching
Clean up the interception to prepare for other cases. Signed-off-by: Colin Walters <[email protected]>
1 parent a9dc522 commit 79e715a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/src/cli.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -903,10 +903,14 @@ impl Opt {
903903
let first: OsString = first.into();
904904
let argv0 = callname_from_argv0(&first);
905905
tracing::debug!("argv0={argv0:?}");
906-
if argv0 == InternalsOpts::GENERATOR_BIN {
907-
let base_args = ["bootc", "internals", "systemd-generator"]
908-
.into_iter()
909-
.map(OsString::from);
906+
let mapped = match argv0 {
907+
InternalsOpts::GENERATOR_BIN => {
908+
Some(["bootc", "internals", "systemd-generator"].as_slice())
909+
}
910+
_ => None,
911+
};
912+
if let Some(base_args) = mapped {
913+
let base_args = base_args.into_iter().map(OsString::from);
910914
return Opt::parse_from(base_args.chain(args.map(|i| i.into())));
911915
}
912916
Some(first)

0 commit comments

Comments
 (0)