Merge pull request 'Improve file injection error handling' (#265) from feat/inject-file-command into master
All checks were successful
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux

Reviewed-on: #265
This commit is contained in:
Lucas Schwiderski 2025-07-01 10:40:42 +02:00
commit 40502e8b66
Signed by: Forgejo (git.sclu1034.dev)
GPG key ID: B1C9C29730D3D366

View file

@ -202,15 +202,13 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> {
let bundle_name = Bundle::get_name_from_path(&ctx, bundle_path);
let mut bundle = {
let binary = fs::read(bundle_path).await?;
Bundle::from_binary(&ctx, bundle_name.clone(), binary)
fs::read(bundle_path)
.await
.map_err(From::from)
.and_then(|binary| Bundle::from_binary(&ctx, bundle_name.clone(), binary))
.wrap_err_with(|| format!("Failed to open bundle '{}'", bundle_path.display()))?
};
if op == "copy" {
unimplemented!("Implement copying a file from one bundle to the other.");
}
let output_bundle = match op {
"replace" => {
let Some(file) = bundle
@ -280,6 +278,9 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> {
"add" => {
unimplemented!("Implement adding a new file to the bundle.");
}
"copy" => {
unimplemented!("Implement copying a file from one bundle to the other.");
}
_ => unreachable!("no other operations exist"),
};