aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/command')
-rw-r--r--crates/shirabe/src/command/diagnose_command.rs16
-rw-r--r--crates/shirabe/src/command/show_command.rs16
2 files changed, 17 insertions, 15 deletions
diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs
index 65240e51..72b58dea 100644
--- a/crates/shirabe/src/command/diagnose_command.rs
+++ b/crates/shirabe/src/command/diagnose_command.rs
@@ -39,10 +39,10 @@ use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_external_packages::symfony::process::ExecutableFinder;
use shirabe_php_shim::{
- InvalidArgumentException, PHP_EOL, PhpMixed, disk_free_space, file_exists, filter_var_boolean,
- get_class_err, hash, impl_php_class, implode, is_array, is_string, php_regex, rtrim,
- str_contains, str_replace, str_starts_with, strpos, strstr, strstr3, strtolower, trim,
- version_compare,
+ CmpOp, InvalidArgumentException, PHP_EOL, PhpMixed, disk_free_space, file_exists,
+ filter_var_boolean, get_class_err, hash, impl_php_class, implode, is_array, is_string,
+ php_regex, rtrim, str_contains, str_replace, str_starts_with, strpos, strstr, strstr3,
+ strtolower, trim, version_compare,
};
#[derive(Debug)]
@@ -153,7 +153,7 @@ impl DiagnoseCommand {
None => return "<comment>No git process found</>".to_string(),
};
- if version_compare("2.24.0", &git_version, ">") {
+ if version_compare("2.24.0", &git_version, CmpOp::Gt) {
return format!(
"<warning>Your git version ({}) is too old and possibly will cause issues. Please upgrade to git 2.24 or above</>",
git_version
@@ -889,9 +889,9 @@ impl DiagnoseCommand {
}
if diagnostics.has_php_windows_version_build
- && (version_compare(&diagnostics.php_version, "7.2.23", "<")
- || (version_compare(&diagnostics.php_version, "7.3.0", ">=")
- && version_compare(&diagnostics.php_version, "7.3.10", "<")))
+ && (version_compare(&diagnostics.php_version, "7.2.23", CmpOp::Lt)
+ || (version_compare(&diagnostics.php_version, "7.3.0", CmpOp::Ge)
+ && version_compare(&diagnostics.php_version, "7.3.10", CmpOp::Lt)))
{
warnings.insert(
"onedrive".to_string(),
diff --git a/crates/shirabe/src/command/show_command.rs b/crates/shirabe/src/command/show_command.rs
index ff20f325..aa63d8e7 100644
--- a/crates/shirabe/src/command/show_command.rs
+++ b/crates/shirabe/src/command/show_command.rs
@@ -43,7 +43,7 @@ use shirabe_external_packages::symfony::console::formatter::OutputFormatterStyle
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{
- DATE_ATOM, InvalidArgumentException, LogicException, PhpMixed, UnexpectedValueException,
+ CmpOp, DATE_ATOM, InvalidArgumentException, LogicException, PhpMixed, UnexpectedValueException,
array_search, date, date_format_to_strftime, extension_loaded, impl_php_class, in_array_loose,
in_array_strict, php_regex, realpath, strtolower, version_compare,
};
@@ -841,9 +841,9 @@ impl ShowCommand {
.collect();
// uasort($versions, 'version_compare');
versions_pairs.sort_by(|a, b| {
- if version_compare(&a.1, &b.1, "<") {
+ if version_compare(&a.1, &b.1, CmpOp::Lt) {
std::cmp::Ordering::Less
- } else if version_compare(&a.1, &b.1, ">") {
+ } else if version_compare(&a.1, &b.1, CmpOp::Gt) {
std::cmp::Ordering::Greater
} else {
std::cmp::Ordering::Equal
@@ -1432,7 +1432,7 @@ impl ShowCommand {
return false;
}
- version_compare(&candidate.get_version(), &package_version, "<=")
+ version_compare(&candidate.get_version(), &package_version, CmpOp::Le)
},
))
};
@@ -2343,9 +2343,11 @@ impl Command for ShowCommand {
let need_replace = match existing {
None => true,
Some(PackageOrName::Name(_)) => true,
- Some(PackageOrName::Pkg(existing)) => {
- version_compare(&existing.get_version(), &package.get_version(), "<")
- }
+ Some(PackageOrName::Pkg(existing)) => version_compare(
+ &existing.get_version(),
+ &package.get_version(),
+ CmpOp::Lt,
+ ),
};
if need_replace {
let mut p: crate::package::PackageInterfaceHandle = package.clone();