aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/console/html_output_formatter.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-19 21:46:01 +0900
committernsfisis <nsfisis@gmail.com>2026-05-19 21:46:08 +0900
commit5e31fa33c3b5cf726a57a063b8e7a070869250fe (patch)
tree98522466966fa7df483cad174ab5fc03db39bc09 /crates/shirabe/src/console/html_output_formatter.rs
parentc839244d8d09f3036ebfee8eef7eb6b147e593ab (diff)
downloadphp-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.tar.gz
php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.tar.zst
php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.zip
fix(compile): fix more random compile errors
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/console/html_output_formatter.rs')
-rw-r--r--crates/shirabe/src/console/html_output_formatter.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/crates/shirabe/src/console/html_output_formatter.rs b/crates/shirabe/src/console/html_output_formatter.rs
index c7be6ee..a0099e5 100644
--- a/crates/shirabe/src/console/html_output_formatter.rs
+++ b/crates/shirabe/src/console/html_output_formatter.rs
@@ -1,7 +1,7 @@
//! ref: composer/src/Composer/Console/HtmlOutputFormatter.php
use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::preg::Preg;
+use shirabe_external_packages::composer::pcre::preg::{CaptureKey, Preg};
use shirabe_external_packages::symfony::console::formatter::output_formatter::OutputFormatter;
use shirabe_external_packages::symfony::console::formatter::output_formatter_style::OutputFormatterStyle;
@@ -58,12 +58,18 @@ impl HtmlOutputFormatter {
clear_escape_codes, clear_escape_codes
);
- Preg::replace_callback(&pattern, |matches| self.format_html(matches), formatted).ok()
+ Preg::replace_callback(&pattern, |matches| self.format_html(matches), &formatted).ok()
}
- fn format_html(&self, matches: Vec<Option<String>>) -> String {
- let codes_str = matches[1].as_deref().unwrap_or("");
- let content = matches[2].as_deref().unwrap_or("");
+ fn format_html(&self, matches: &IndexMap<CaptureKey, String>) -> String {
+ let codes_str = matches
+ .get(&CaptureKey::ByIndex(1))
+ .map(|s| s.as_str())
+ .unwrap_or("");
+ let content = matches
+ .get(&CaptureKey::ByIndex(2))
+ .map(|s| s.as_str())
+ .unwrap_or("");
let mut out = String::from("<span style=\"");
for code_str in codes_str.split(';') {