From 90ccc21f0d3c2c66fb2fabfaee34e7cef6de09b8 Mon Sep 17 00:00:00 2001 From: Robin Avery Date: Thu, 29 Feb 2024 18:57:01 -0500 Subject: [PATCH] Tighten argument matching --- objdiff-cli/src/cmd/diff.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/objdiff-cli/src/cmd/diff.rs b/objdiff-cli/src/cmd/diff.rs index 78adcb1..186936d 100644 --- a/objdiff-cli/src/cmd/diff.rs +++ b/objdiff-cli/src/cmd/diff.rs @@ -53,8 +53,8 @@ pub struct Args { pub fn run(args: Args) -> Result<()> { let (target_path, base_path, project_config) = match (&args.target, &args.base, &args.project, &args.unit) { - (Some(t), Some(b), _, _) => (Some(t.clone()), Some(b.clone()), None), - (_, _, p, u) => { + (Some(t), Some(b), None, None) => (Some(t.clone()), Some(b.clone()), None), + (None, None, p, u) => { let project = match p { Some(project) => project.clone(), _ => std::env::current_dir().context("Failed to get the current directory")?, @@ -114,6 +114,7 @@ pub fn run(args: Args) -> Result<()> { let base_path = object.base_path.clone(); (target_path, base_path, Some(project_config)) } + _ => bail!("Either target and base or project and unit must be specified"), }; let mut state = FunctionDiffUi { clear: true,