diff --git a/src/main.rs b/src/main.rs index dc3fc6160..14f97d745 100644 --- a/src/main.rs +++ b/src/main.rs @@ -59,6 +59,7 @@ mod words; #[macro_use] extern crate log; +use crossterm::tty::IsTty as _; use display::style::print_warning; use log::info; use options::FilePermissions; @@ -518,7 +519,12 @@ fn diff_conflicts_file( if conflict_files.num_conflicts == 0 { eprintln!( - "error: Difftastic requires two paths, or a single file with conflict markers {}.\n", + "{}: Difftastic requires two paths, or a single file with conflict markers {}.\n", + if std::io::stdout().is_tty() { + "error".red().bold().to_string() + } else { + "error".to_owned() + }, START_LHS_MARKER, ); diff --git a/src/options.rs b/src/options.rs index dda2171cf..a7314e6d6 100644 --- a/src/options.rs +++ b/src/options.rs @@ -958,7 +958,12 @@ pub(crate) fn parse_args() -> Mode { _ => { if !args.is_empty() { eprintln!( - "error: Difftastic does not support being called with {} argument{}.\n", + "{}: Difftastic does not support being called with {} argument{}.\n", + if use_color { + "error".red().bold().to_string() + } else { + "error".to_owned() + }, args.len(), if args.len() == 1 { "" } else { "s" } );