Skip to content

Commit 70162f9

Browse files
authored
🎨 Optimize parameter parsing of resolve command
1 parent e67b56b commit 70162f9

File tree

2 files changed

+280
-107
lines changed

2 files changed

+280
-107
lines changed

src/cli.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,18 @@ impl Cli {
5656
let itr = itr.into_iter().collect::<Vec<_>>();
5757
match Self::try_parse_from(itr.clone()) {
5858
Ok(cli) => cli,
59-
Err(e) => match CompatibleCli::try_parse_from(itr) {
60-
Ok(cli) => cli.into(),
61-
Err(_) => e.exit(),
62-
},
59+
Err(e) => {
60+
#[cfg(feature = "resolve-cli")]
61+
if let Ok(resolve_command) = ResolveCommand::try_parse_from(itr.clone()) {
62+
return resolve_command.into();
63+
}
64+
65+
if let Ok(cli) = CompatibleCli::try_parse_from(itr) {
66+
return cli.into();
67+
}
68+
69+
e.exit()
70+
}
6371
}
6472
}
6573

0 commit comments

Comments
 (0)