From e11ad476fcf1eaf45236b92b1c7854f9827a4291 Mon Sep 17 00:00:00 2001 From: Micah <48431591+nezuo@users.noreply.github.com> Date: Mon, 11 Sep 2023 15:32:43 -0500 Subject: [PATCH] Use `conflicts_with` for build flags (#779) --- src/cli/build.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/cli/build.rs b/src/cli/build.rs index 8f705d376..0593cc05b 100644 --- a/src/cli/build.rs +++ b/src/cli/build.rs @@ -30,13 +30,13 @@ pub struct BuildCommand { /// Where to output the result. /// /// Should end in .rbxm, .rbxl, .rbxmx, or .rbxlx. - #[clap(long, short)] + #[clap(long, short, conflicts_with = "plugin")] pub output: Option, /// Alternative to the output flag that outputs the result in the local plugins folder. /// /// Should end in .rbxm or .rbxl. - #[clap(long, short)] + #[clap(long, short, conflicts_with = "output")] pub plugin: Option, /// Whether to automatically rebuild when any input files change. @@ -47,14 +47,6 @@ pub struct BuildCommand { impl BuildCommand { pub fn run(self) -> anyhow::Result<()> { let (output_path, output_kind) = match (self.output, self.plugin) { - (Some(_), Some(_)) => { - BuildCommand::command() - .error( - clap::ErrorKind::ArgumentConflict, - "the argument '--output ' cannot be used with '--plugin '", - ) - .exit(); - } (None, None) => { BuildCommand::command() .error( @@ -80,6 +72,7 @@ impl BuildCommand { (studio.plugins_path().join(&plugin), output_kind) } + _ => unreachable!(), }; let project_path = resolve_path(&self.project);