fixed get_writeable_color and write_color_buffer arguments

This commit is contained in:
DustInDark
2022-06-22 22:45:38 +09:00
parent 717e4dec06
commit 8a47d37c64
5 changed files with 40 additions and 29 deletions
+2 -2
View File
@@ -324,7 +324,7 @@ impl AlertMessage {
/// ERRORメッセージを表示する関数
pub fn alert(contents: &str) -> io::Result<()> {
write_color_buffer(
BufferWriter::stderr(ColorChoice::Always),
&BufferWriter::stderr(ColorChoice::Always),
None,
&format!("[ERROR] {}", contents),
)
@@ -333,7 +333,7 @@ impl AlertMessage {
/// WARNメッセージを表示する関数
pub fn warn(contents: &str) -> io::Result<()> {
write_color_buffer(
BufferWriter::stderr(ColorChoice::Always),
&BufferWriter::stderr(ColorChoice::Always),
None,
&format!("[WARN] {}", contents),
)
+3 -3
View File
@@ -242,7 +242,7 @@ pub fn create_rec_info(data: Value, path: String, keys: &[String]) -> EvtxRecord
* 標準出力のカラー出力設定を指定した値に変更し画面出力を行う関数
*/
pub fn write_color_buffer(
wtr: BufferWriter,
wtr: &BufferWriter,
color: Option<Color>,
output_str: &str,
) -> io::Result<()> {
@@ -253,11 +253,11 @@ pub fn write_color_buffer(
}
/// no-colorのオプションの指定があるかを確認し、指定されている場合はNoneをかえし、指定されていない場合は引数で指定されたColorをSomeでラップして返す関数
pub fn get_writable_color(color: Color) -> Option<Color> {
pub fn get_writable_color(color: Option<Color>) -> Option<Color> {
if configs::CONFIG.read().unwrap().args.no_color {
None
} else {
Some(color)
color
}
}