aboutsummaryrefslogtreecommitdiff
path: root/src/output/formats.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/output/formats.rs')
-rw-r--r--src/output/formats.rs23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/output/formats.rs b/src/output/formats.rs
index 5915069..b697401 100644
--- a/src/output/formats.rs
+++ b/src/output/formats.rs
@@ -2,6 +2,7 @@
use std::fmt::Write;
use super::{LogResult, FightOutcome};
+use super::super::guilds;
/// An output format
pub trait Format: Sync + Send {
@@ -12,7 +13,9 @@ pub trait Format: Sync + Send {
/// The human readable, colored format.
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
-pub struct HumanReadable;
+pub struct HumanReadable {
+ pub show_guilds: bool,
+}
impl Format for HumanReadable {
@@ -35,14 +38,26 @@ impl Format for HumanReadable {
outcome,
).unwrap();
for player in &item.players {
- writeln!(
+ write!(
result,
- " {:2} {:20} {:19} {}",
+ " {:2} {:20} {:19} {:12}",
player.subgroup,
player.account_name.yellow(),
player.character_name.cyan(),
- player.profession
+ player.profession,
).unwrap();
+ if self.show_guilds {
+ let guild = player.guild_id.as_ref().and_then(|id| guilds::lookup(id));
+ if let Some(guild) = guild {
+ write!(
+ result,
+ " [{}] {}",
+ guild.tag().magenta(),
+ guild.name().magenta(),
+ ).unwrap();
+ }
+ }
+ writeln!(result).unwrap();
}
result
}