aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index c8afd0f..e0d0e89 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,12 +6,14 @@ extern crate itertools;
extern crate md5;
extern crate reqwest;
extern crate rusttype;
+extern crate termcolor;
extern crate xdg;
#[macro_use]
extern crate quick_error;
use std::error::Error as StdError;
use std::fmt;
+use std::io::Write;
mod api;
mod bt;
@@ -19,6 +21,7 @@ mod cache;
mod render;
use clap::{App, Arg, ArgMatches};
+use termcolor::{StandardStream, WriteColor, ColorSpec, Color, ColorChoice};
use api::{Api, Profession, Skill};
use bt::{BuildTemplate, ExtraData, Legend, TraitChoice, Traitline};
@@ -291,7 +294,13 @@ fn run() -> MainResult<()> {
fn main() {
let result = run();
if let Err(e) = result {
- eprintln!("[Error] {}", e);
+ let mut error_color = ColorSpec::new();
+ error_color.set_fg(Some(Color::Red));
+ let mut stderr = StandardStream::stderr(ColorChoice::Auto);
+ stderr.set_color(&error_color);
+ write!(stderr, "[Error]");
+ stderr.reset();
+ writeln!(stderr, " {}", e);
let mut source = e.source();
while let Some(s) = source {
eprintln!(" caused by {}", s);