aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader/vcs_downloader.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-17 02:53:53 +0900
committernsfisis <nsfisis@gmail.com>2026-05-17 02:53:53 +0900
commita1c7e6908a26e10f6e1f23a51721664b5e2d838d (patch)
treec575c76f1b43359ed74913da4c6a2636643f1ba0 /crates/shirabe/src/downloader/vcs_downloader.rs
parent7f606f36fef0c0467c3c0db3d0da33af486dae8a (diff)
downloadphp-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.tar.gz
php-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.tar.zst
php-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.zip
chore(style): cargo fmt
Diffstat (limited to 'crates/shirabe/src/downloader/vcs_downloader.rs')
-rw-r--r--crates/shirabe/src/downloader/vcs_downloader.rs61
1 files changed, 26 insertions, 35 deletions
diff --git a/crates/shirabe/src/downloader/vcs_downloader.rs b/crates/shirabe/src/downloader/vcs_downloader.rs
index 3fb305f..37954d2 100644
--- a/crates/shirabe/src/downloader/vcs_downloader.rs
+++ b/crates/shirabe/src/downloader/vcs_downloader.rs
@@ -4,9 +4,8 @@ use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::react::promise::promise_interface::PromiseInterface;
use shirabe_php_shim::{
- array_map, array_shift, count, explode, get_class, implode, rawurldecode, realpath,
- str_replace, strlen, strpos, substr, trim, InvalidArgumentException, PhpMixed,
- RuntimeException,
+ InvalidArgumentException, PhpMixed, RuntimeException, array_map, array_shift, count, explode,
+ get_class, implode, rawurldecode, realpath, str_replace, strlen, strpos, substr, trim,
};
use crate::config::Config;
@@ -91,11 +90,7 @@ impl VcsDownloader {
}
if self.io.is_debug() {
self.io.write_error(
- PhpMixed::String(format!(
- "Failed: [{}] {}",
- get_class(&e),
- e,
- )),
+ PhpMixed::String(format!("Failed: [{}] {}", get_class(&e), e,)),
true,
IOInterface::NORMAL,
);
@@ -183,7 +178,10 @@ impl VcsDownloader {
}
self.io.write_error(
- PhpMixed::String(format!(" - {}: ", InstallOperation::format(package, false))),
+ PhpMixed::String(format!(
+ " - {}: ",
+ InstallOperation::format(package, false)
+ )),
false,
IOInterface::NORMAL,
);
@@ -203,11 +201,7 @@ impl VcsDownloader {
}
if self.io.is_debug() {
self.io.write_error(
- PhpMixed::String(format!(
- "Failed: [{}] {}",
- get_class(&e),
- e,
- )),
+ PhpMixed::String(format!("Failed: [{}] {}", get_class(&e), e,)),
true,
IOInterface::NORMAL,
);
@@ -285,11 +279,7 @@ impl VcsDownloader {
}
if self.io.is_debug() {
self.io.write_error(
- PhpMixed::String(format!(
- "Failed: [{}] {}",
- get_class(&e),
- e,
- )),
+ PhpMixed::String(format!("Failed: [{}] {}", get_class(&e), e,)),
true,
IOInterface::NORMAL,
);
@@ -364,7 +354,10 @@ impl VcsDownloader {
path: &str,
) -> Result<Box<dyn PromiseInterface>> {
self.io.write_error(
- PhpMixed::String(format!(" - {}", UninstallOperation::format(package, false))),
+ PhpMixed::String(format!(
+ " - {}",
+ UninstallOperation::format(package, false)
+ )),
true,
IOInterface::NORMAL,
);
@@ -372,24 +365,22 @@ impl VcsDownloader {
let promise = self.filesystem.remove_directory_async(path);
let path = path.to_string();
- Ok(promise.then(Box::new(move |result: PhpMixed| -> Result<()> {
- let result_bool = result.as_bool().unwrap_or(false);
- if !result_bool {
- return Err(RuntimeException {
- message: format!("Could not completely delete {}, aborting.", path),
- code: 0,
+ Ok(
+ promise.then(Box::new(move |result: PhpMixed| -> Result<()> {
+ let result_bool = result.as_bool().unwrap_or(false);
+ if !result_bool {
+ return Err(RuntimeException {
+ message: format!("Could not completely delete {}, aborting.", path),
+ code: 0,
+ }
+ .into());
}
- .into());
- }
- Ok(())
- })))
+ Ok(())
+ })),
+ )
}
- pub fn get_vcs_reference(
- &self,
- package: &dyn PackageInterface,
- path: &str,
- ) -> Option<String> {
+ pub fn get_vcs_reference(&self, package: &dyn PackageInterface, path: &str) -> Option<String> {
let parser = VersionParser::new();
let guesser = VersionGuesser::new(&self.config, &self.process, &parser, &*self.io);
let dumper = ArrayDumper::new();