Skip to content

Commit

Permalink
🎨 Optimize parameter parsing of resolve command
Browse files Browse the repository at this point in the history
  • Loading branch information
mokeyish authored Nov 23, 2024
1 parent e67b56b commit 70162f9
Show file tree
Hide file tree
Showing 2 changed files with 280 additions and 107 deletions.
16 changes: 12 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,18 @@ impl Cli {
let itr = itr.into_iter().collect::<Vec<_>>();
match Self::try_parse_from(itr.clone()) {
Ok(cli) => cli,
Err(e) => match CompatibleCli::try_parse_from(itr) {
Ok(cli) => cli.into(),
Err(_) => e.exit(),
},
Err(e) => {
#[cfg(feature = "resolve-cli")]
if let Ok(resolve_command) = ResolveCommand::try_parse_from(itr.clone()) {
return resolve_command.into();
}

if let Ok(cli) = CompatibleCli::try_parse_from(itr) {
return cli.into();
}

e.exit()
}
}
}

Expand Down
Loading

0 comments on commit 70162f9

Please sign in to comment.