Skip to content

Commit

Permalink
cli: Prepare for other argv0 dispatching
Browse files Browse the repository at this point in the history
Clean up the interception to prepare for other cases.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Nov 22, 2024
1 parent 1dd7501 commit a132bba
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,10 +912,14 @@ impl Opt {
let first: OsString = first.into();
let argv0 = callname_from_argv0(&first);
tracing::debug!("argv0={argv0:?}");
if argv0 == InternalsOpts::GENERATOR_BIN {
let base_args = ["bootc", "internals", "systemd-generator"]
.into_iter()
.map(OsString::from);
let mapped = match argv0 {
InternalsOpts::GENERATOR_BIN => {
Some(["bootc", "internals", "systemd-generator"].as_slice())
}
_ => None,
};
if let Some(base_args) = mapped {
let base_args = base_args.into_iter().map(OsString::from);
return Opt::parse_from(base_args.chain(args.map(|i| i.into())));
}
Some(first)
Expand Down

0 comments on commit a132bba

Please sign in to comment.