aboutsummaryrefslogtreecommitdiff
path: root/src/output/formats.rs
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2020-04-26 11:45:37 +0200
committerDaniel <kingdread@gmx.de>2020-04-26 11:45:37 +0200
commit13053073e3336b8e6ffefd6a056d159239550be7 (patch)
tree63544e8764b55563a48d3f9fd530b0381f42a277 /src/output/formats.rs
parent3c429432382dfad6d4ac97349c96e4a4eb292089 (diff)
parent9bbd5db2a6caae10f0ab2cf2625fbc34485a4ce9 (diff)
downloadraidgrep-13053073e3336b8e6ffefd6a056d159239550be7.tar.gz
raidgrep-13053073e3336b8e6ffefd6a056d159239550be7.tar.bz2
raidgrep-13053073e3336b8e6ffefd6a056d159239550be7.zip
Merge branch 'new-filters'
The new filter system (includes both the internal rewrite and the command line parsing) is now being included in master. This gives a lot more flexibility.
Diffstat (limited to 'src/output/formats.rs')
-rw-r--r--src/output/formats.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/output/formats.rs b/src/output/formats.rs
index b697401..a608eab 100644
--- a/src/output/formats.rs
+++ b/src/output/formats.rs
@@ -1,8 +1,8 @@
//! A crate defining different output formats for search results.
use std::fmt::Write;
-use super::{LogResult, FightOutcome};
use super::super::guilds;
+use super::{FightOutcome, LogResult};
/// An output format
pub trait Format: Sync + Send {
@@ -10,14 +10,12 @@ pub trait Format: Sync + Send {
fn format_result(&self, item: &LogResult) -> String;
}
-
/// The human readable, colored format.
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub struct HumanReadable {
pub show_guilds: bool,
}
-
impl Format for HumanReadable {
fn format_result(&self, item: &LogResult) -> String {
use colored::Colorize;
@@ -36,7 +34,8 @@ impl Format for HumanReadable {
"Boss".green(),
item.boss_name,
outcome,
- ).unwrap();
+ )
+ .unwrap();
for player in &item.players {
write!(
result,
@@ -45,7 +44,8 @@ impl Format for HumanReadable {
player.account_name.yellow(),
player.character_name.cyan(),
player.profession,
- ).unwrap();
+ )
+ .unwrap();
if self.show_guilds {
let guild = player.guild_id.as_ref().and_then(|id| guilds::lookup(id));
if let Some(guild) = guild {
@@ -54,7 +54,8 @@ impl Format for HumanReadable {
" [{}] {}",
guild.tag().magenta(),
guild.name().magenta(),
- ).unwrap();
+ )
+ .unwrap();
}
}
writeln!(result).unwrap();
@@ -63,12 +64,10 @@ impl Format for HumanReadable {
}
}
-
/// A format which outputs only the file-name
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub struct FileOnly;
-
impl Format for FileOnly {
fn format_result(&self, item: &LogResult) -> String {
let filename = item.log_file.to_string_lossy();