diff --git a/.changes/error-out-if-no-config.md b/.changes/error-out-if-no-config.md new file mode 100644 index 00000000..eacac4f7 --- /dev/null +++ b/.changes/error-out-if-no-config.md @@ -0,0 +1,5 @@ +--- +"cargo-packager": patch +--- + +Error out if we cannot find a configuration file. diff --git a/Cargo.lock b/Cargo.lock index 01f83774..b59bc92f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -978,7 +978,7 @@ dependencies = [ [[package]] name = "cargo-packager" -version = "0.6.1" +version = "0.7.0" dependencies = [ "ar", "base64 0.21.7", @@ -1035,7 +1035,7 @@ dependencies = [ [[package]] name = "cargo-packager-resource-resolver" -version = "0.1.0" +version = "0.1.1" dependencies = [ "cargo-packager-utils", "heck 0.4.1", diff --git a/crates/packager/src/cli/mod.rs b/crates/packager/src/cli/mod.rs index 2a925a1c..b612eb7e 100644 --- a/crates/packager/src/cli/mod.rs +++ b/crates/packager/src/cli/mod.rs @@ -135,8 +135,7 @@ fn run_cli(cli: Cli) -> Result<()> { }; if configs.is_empty() { - tracing::debug!("Couldn't detect a valid configuration file or all configurations are disabled! Nothing to do here."); - return Ok(()); + return Err(crate::Error::NoConfig); } let cli_out_dir = cli.out_dir.as_ref().map(dunce::canonicalize).transpose()?; diff --git a/crates/packager/src/error.rs b/crates/packager/src/error.rs index b1557e49..a73d6440 100644 --- a/crates/packager/src/error.rs +++ b/crates/packager/src/error.rs @@ -32,6 +32,9 @@ pub enum Error { /// Target triple environment error #[error("Unable to determine target-environment")] Environment, + /// No config file found. + #[error("Couldn't detect a valid configuration file or all configurations are disabled.")] + NoConfig, /// I/O errors. #[error(transparent)] Io(#[from] std::io::Error),