Skip to content

Commit

Permalink
Add color to bin/gen error messages
Browse files Browse the repository at this point in the history
type: development
  • Loading branch information
casey committed Apr 30, 2020
1 parent 8dfdbe4 commit 60a72cf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion bin/gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ edition = "2018"
publish = false

[dependencies]
ansi_term = "0.12.1"
askama = "0.9.0"
cargo_toml = "0.8.0"
chrono = "0.4.11"
fehler = "1.0.0"
git2 = "0.13.1"
globset = "0.4.5"
ignore = "0.4.14"
lexiclean = "0.0.1"
libc = "0.2.69"
log = "0.4.8"
pretty_env_logger = "0.4.0"
Expand All @@ -24,7 +26,6 @@ strum = "0.18.0"
strum_macros = "0.18.0"
tempfile = "3.1.0"
walkdir = "2.3.1"
lexiclean = "0.0.1"

[dependencies.serde]
version = "1.0.106"
Expand Down
1 change: 1 addition & 0 deletions bin/gen/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub(crate) use std::{
str,
};

pub(crate) use ansi_term::Style;
pub(crate) use askama::Template;
pub(crate) use cargo_toml::Manifest;
pub(crate) use chrono::{DateTime, NaiveDateTime, Utc};
Expand Down
4 changes: 3 additions & 1 deletion bin/gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ fn main() {
pretty_env_logger::init();

if let Err(error) = Opt::from_args().run() {
eprintln!("{}", error);
let bold = Style::new().bold();
let red = Style::new().fg(ansi_term::Color::Red).bold();
eprintln!("{}: {}", red.paint("error"), bold.paint(error.to_string()));
process::exit(EXIT_FAILURE);
}
}

0 comments on commit 60a72cf

Please sign in to comment.