//! ref: composer/src/Composer/Console/HtmlOutputFormatter.php
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
use shirabe_external_packages::symfony::console::formatter::OutputFormatterInterface;
use shirabe_external_packages::symfony::console::formatter::OutputFormatterStyleInterface;
#[derive(Debug)]
pub struct HtmlOutputFormatter {
inner: OutputFormatter,
}
impl HtmlOutputFormatter {
const AVAILABLE_FOREGROUND_COLORS: &'static [(i64, &'static str)] = &[
(30, "black"),
(31, "red"),
(32, "green"),
(33, "yellow"),
(34, "blue"),
(35, "magenta"),
(36, "cyan"),
(37, "white"),
];
const AVAILABLE_BACKGROUND_COLORS: &'static [(i64, &'static str)] = &[
(40, "black"),
(41, "red"),
(42, "green"),
(43, "yellow"),
(44, "blue"),
(45, "magenta"),
(46, "cyan"),
(47, "white"),
];
const AVAILABLE_OPTIONS: &'static [(i64, &'static str)] = &[
(1, "bold"),
(4, "underscore"),
//5 => "blink",
//7 => "reverse",
//8 => "conceal"
];
pub fn new(styles: IndexMap>) -> Self {
Self {
inner: OutputFormatter::new(true, styles),
}
}
pub fn format(&mut self, message: Option<&str>) -> anyhow::Result