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/archive_command.rs4
-rw-r--r--crates/shirabe/src/command/config_command.rs22
-rw-r--r--crates/shirabe/src/command/create_project_command.rs4
-rw-r--r--crates/shirabe/src/command/diagnose_command.rs4
-rw-r--r--crates/shirabe/src/command/init_command.rs6
-rw-r--r--crates/shirabe/src/command/package_discovery_trait.rs4
-rw-r--r--crates/shirabe/src/command/show_command.rs4
7 files changed, 24 insertions, 24 deletions
diff --git a/crates/shirabe/src/command/archive_command.rs b/crates/shirabe/src/command/archive_command.rs
index 452103d9..1d7165ac 100644
--- a/crates/shirabe/src/command/archive_command.rs
+++ b/crates/shirabe/src/command/archive_command.rs
@@ -26,7 +26,7 @@ use crate::util::Platform;
use crate::util::ProcessExecutor;
use crate::util::r#loop::Loop;
use indexmap::IndexMap;
-use shirabe_pcre::{CaptureKey, Preg};
+use shirabe_pcre::{CaptureKey, Preg, PregMatchedGroups};
use shirabe_php_shim::{LogicException, get_debug_type, impl_php_class, php_regex};
use shirabe_symfony_console::command::Command;
use shirabe_symfony_console::input::InputInterface;
@@ -229,7 +229,7 @@ impl ArchiveCommand {
}
if let Some(version_str) = &version {
- let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut matches = PregMatchedGroups::new();
if Preg::match3(
php_regex!(r"{@(stable|RC|beta|alpha|dev)$}i"),
version_str,
diff --git a/crates/shirabe/src/command/config_command.rs b/crates/shirabe/src/command/config_command.rs
index 504a0f11..550ddf3c 100644
--- a/crates/shirabe/src/command/config_command.rs
+++ b/crates/shirabe/src/command/config_command.rs
@@ -18,7 +18,7 @@ use crate::util::Filesystem;
use crate::util::Platform;
use crate::util::Silencer;
use indexmap::IndexMap;
-use shirabe_pcre::{CaptureKey, Preg};
+use shirabe_pcre::{CaptureKey, Preg, PregMatchedGroups};
use shirabe_php_shim::{
InvalidArgumentException, PhpMixed, RuntimeException, array_is_list, array_merge,
escapeshellcmd, exec, explode, file_exists, impl_php_class, implode, in_array_loose,
@@ -701,7 +701,7 @@ impl Command for ConfigCommand {
let mut source = config.borrow_mut().get_source_of_value(&setting_key);
let mut value: PhpMixed;
- let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut matches = PregMatchedGroups::new();
if Preg::is_match3(
php_regex!("/^repos?(?:itories)?(?:\\.(.+))?/"),
&setting_key,
@@ -929,7 +929,7 @@ impl Command for ConfigCommand {
return Ok(0);
}
// handle preferred-install per-package config
- let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut matches = PregMatchedGroups::new();
if Preg::is_match3(
php_regex!("/^preferred-install\\.(.+)/"),
&setting_key,
@@ -967,7 +967,7 @@ impl Command for ConfigCommand {
}
// handle allow-plugins config setting elements true or false to add/remove
- let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut matches = PregMatchedGroups::new();
if Preg::is_match3(
php_regex!("{^allow-plugins\\.([a-zA-Z0-9/*-]+)}"),
&setting_key,
@@ -1037,7 +1037,7 @@ impl Command for ConfigCommand {
}
// handle repositories
- let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut matches = PregMatchedGroups::new();
if Preg::is_match3(
php_regex!("/^repos?(?:itories)?\\.(.+)/"),
&setting_key,
@@ -1110,7 +1110,7 @@ impl Command for ConfigCommand {
}
// handle extra
- let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut matches = PregMatchedGroups::new();
if Preg::is_match3(
php_regex!("/^extra\\.(.+)/"),
&setting_key,
@@ -1187,7 +1187,7 @@ impl Command for ConfigCommand {
}
// handle suggest
- let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut matches = PregMatchedGroups::new();
if Preg::is_match3(
php_regex!("/^suggest\\.(.+)/"),
&setting_key,
@@ -1226,7 +1226,7 @@ impl Command for ConfigCommand {
}
// handle platform
- let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut matches = PregMatchedGroups::new();
if Preg::is_match3(
php_regex!("/^platform\\.(.+)/"),
&setting_key,
@@ -1348,7 +1348,7 @@ impl Command for ConfigCommand {
}
// handle auth
- let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut matches = PregMatchedGroups::new();
if Preg::is_match3(
php_regex!(
"/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|custom-headers|bearer|forgejo-token)\\.(.+)/"
@@ -1474,7 +1474,7 @@ impl Command for ConfigCommand {
}
// Check if the header is in correct "Name: Value" format
- let mut header_parts: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut header_parts = PregMatchedGroups::new();
if !Preg::is_match3(
php_regex!("/^[^:]+:\\s*.+$/"),
header,
@@ -1527,7 +1527,7 @@ impl Command for ConfigCommand {
}
// handle script
- let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut matches = PregMatchedGroups::new();
if Preg::is_match3(
php_regex!("/^scripts\\.(.+)/"),
&setting_key,
diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs
index 124f809b..33bfb021 100644
--- a/crates/shirabe/src/command/create_project_command.rs
+++ b/crates/shirabe/src/command/create_project_command.rs
@@ -37,7 +37,7 @@ use crate::util::Filesystem;
use crate::util::Platform;
use crate::util::ProcessExecutor;
use indexmap::IndexMap;
-use shirabe_pcre::{CaptureKey, Preg};
+use shirabe_pcre::{CaptureKey, Preg, PregMatchedGroups};
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
InvalidArgumentException, PhpMixed, RuntimeException, UnexpectedValueException, array_pop,
@@ -527,7 +527,7 @@ impl CreateProjectCommand {
stability = Some("stable".to_string());
} else {
let ok = {
- let mut matched: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut matched = PregMatchedGroups::new();
let ok = Preg::is_match3(
format!(
"{{^[^,\\s]*?@({})$}}i",
diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs
index 4b148c09..aa581c82 100644
--- a/crates/shirabe/src/command/diagnose_command.rs
+++ b/crates/shirabe/src/command/diagnose_command.rs
@@ -33,7 +33,7 @@ use crate::util::ProcessExecutor;
use crate::util::http::ProxyManager;
use crate::util::http::RequestProxy;
use indexmap::IndexMap;
-use shirabe_pcre::{CaptureKey, Preg};
+use shirabe_pcre::{CaptureKey, Preg, PregMatchedGroups};
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
AnyThrowable, CmpOp, InvalidArgumentException, PHP_EOL, PhpClass as _, PhpMixed,
@@ -862,7 +862,7 @@ impl DiagnoseCommand {
warnings.insert("zlib".to_string(), PhpMixed::Bool(true));
}
- let mut phpinfo_match: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut phpinfo_match = PregMatchedGroups::new();
if Preg::is_match3(
php_regex!("{Configure Command(?: *</td><td class=\"v\">| *=> *)(.*?)(?:</td>|$)}m"),
&diagnostics.phpinfo_general,
diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs
index af3d16e2..243df290 100644
--- a/crates/shirabe/src/command/init_command.rs
+++ b/crates/shirabe/src/command/init_command.rs
@@ -19,7 +19,7 @@ use crate::util::Filesystem;
use crate::util::ProcessExecutor;
use crate::util::Silencer;
use indexmap::IndexMap;
-use shirabe_pcre::{CaptureKey, Preg};
+use shirabe_pcre::{CaptureKey, Preg, PregMatchedGroups, PregMatchesAll};
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
FILE_IGNORE_NEW_LINES, InvalidArgumentException, PHP_EOL, PHP_SERVER, PhpMixed,
@@ -90,7 +90,7 @@ impl InitCommand {
&self,
author: &str,
) -> anyhow::Result<IndexMap<String, Option<String>>> {
- let mut m: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut m = PregMatchedGroups::new();
if Preg::is_match3(
php_regex!(r#"/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’\"()]+)(?:\s+<(?P<email>.+?)>)?$/u"#),
author,
@@ -175,7 +175,7 @@ impl InitCommand {
) == 0
{
*self.git_config.borrow_mut() = Some(IndexMap::new());
- let mut m: IndexMap<CaptureKey, Vec<Option<String>>> = IndexMap::new();
+ let mut m = PregMatchesAll::new();
if Preg::is_match_all(php_regex!(r"{^([^=]+)=(.*)$}m"), &output, &mut m) {
let keys: Vec<Option<String>> =
m.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default();
diff --git a/crates/shirabe/src/command/package_discovery_trait.rs b/crates/shirabe/src/command/package_discovery_trait.rs
index 88c90a5a..877cc7da 100644
--- a/crates/shirabe/src/command/package_discovery_trait.rs
+++ b/crates/shirabe/src/command/package_discovery_trait.rs
@@ -19,7 +19,7 @@ use crate::repository::RepositorySet;
use crate::repository::{RepositoryInterface, SearchResult};
use crate::util::Filesystem;
use indexmap::IndexMap;
-use shirabe_pcre::{CaptureKey, Preg};
+use shirabe_pcre::{CaptureKey, Preg, PregMatchedGroups};
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
Exception, InvalidArgumentException, LogicException, PHP_EOL, PhpMixed, array_keys,
@@ -330,7 +330,7 @@ pub trait PackageDiscoveryTrait: BaseCommand {
}
}
- let mut m: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut m = PregMatchedGroups::new();
if Preg::is_match3(
php_regex!(r"{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}"),
&selection,
diff --git a/crates/shirabe/src/command/show_command.rs b/crates/shirabe/src/command/show_command.rs
index d02295d5..e8be4da5 100644
--- a/crates/shirabe/src/command/show_command.rs
+++ b/crates/shirabe/src/command/show_command.rs
@@ -36,7 +36,7 @@ use crate::repository::RepositoryUtils;
use crate::repository::RootPackageRepository;
use crate::util::PackageInfo;
use indexmap::IndexMap;
-use shirabe_pcre::{CaptureKey, Preg};
+use shirabe_pcre::{CaptureKey, Preg, PregMatchedGroups};
use shirabe_php_shim::{
CmpOp, DATE_ATOM, InvalidArgumentException, LogicException, PhpMixed, UnexpectedValueException,
array_search, date_format_to_strftime, date_local, extension_loaded, impl_php_class,
@@ -1372,7 +1372,7 @@ impl ShowCommand {
}
if target_version.is_none() {
- let mut groups: IndexMap<CaptureKey, String> = IndexMap::new();
+ let mut groups = PregMatchedGroups::new();
if major_only
&& Preg::is_match3(
php_regex!(r"{^(?P<zero_major>(?:0\.)+)?(?P<first_meaningful>\d+)\.}"),