Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use conflicts_with for build flags #779

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions src/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PathBuf>,

/// 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<PathBuf>,

/// Whether to automatically rebuild when any input files change.
Expand All @@ -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 <OUTPUT>' cannot be used with '--plugin <PLUGIN>'",
)
.exit();
}
(None, None) => {
BuildCommand::command()
.error(
Expand All @@ -80,6 +72,7 @@ impl BuildCommand {

(studio.plugins_path().join(&plugin), output_kind)
}
_ => unreachable!(),
};

let project_path = resolve_path(&self.project);
Expand Down
Loading