Skip to content

Commit

Permalink
Use nu-ansi-term instead of ansi_term
Browse files Browse the repository at this point in the history
The `nu-ansi-term` crate is a fork of `ansi_term` which is maintained by
the Nushell project.
  • Loading branch information
nickelc committed Mar 18, 2023
1 parent d20405b commit 9cc87f4
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine

[dependencies]
atty = { version = "0.2.14", optional = true }
ansi_term = "^0.12.1"
ansi_term = { version = "0.47", package = "nu-ansi-term" }
ansi_colours = "^1.2"
bincode = "1.0"
console = "0.15.5"
Expand Down
2 changes: 1 addition & 1 deletion src/bin/bat/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::io::{BufReader, Write};
use std::path::Path;
use std::process;

use ansi_term::Colour::Green;
use ansi_term::Color::Green;
use ansi_term::Style;

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl From<String> for Error {
pub type Result<T> = std::result::Result<T, Error>;

pub fn default_error_handler(error: &Error, output: &mut dyn Write) {
use ansi_term::Colour::Red;
use ansi_term::Color::Red;

match error {
Error::Io(ref io_error) if io_error.kind() == ::std::io::ErrorKind::BrokenPipe => {
Expand Down
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[macro_export]
macro_rules! bat_warning {
($($arg:tt)*) => ({
use ansi_term::Colour::Yellow;
use ansi_term::Color::Yellow;
eprintln!("{}: {}", Yellow.paint("[bat warning]"), format!($($arg)*));
})
}
2 changes: 1 addition & 1 deletion src/printer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::io::Write;
use std::vec::Vec;

use ansi_term::Colour::{Fixed, Green, Red, Yellow};
use ansi_term::Color::{Fixed, Green, Red, Yellow};
use ansi_term::Style;

use bytesize::ByteSize;
Expand Down
4 changes: 2 additions & 2 deletions src/terminal.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use ansi_term::Color::{self, Fixed, RGB};
use ansi_term::Color::{self, Fixed, Rgb};
use ansi_term::{self, Style};

use syntect::highlighting::{self, FontStyle};
Expand Down Expand Up @@ -38,7 +38,7 @@ pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> Option<ans
// 01. The built-in theme ansi uses this.
None
} else if true_color {
Some(RGB(color.r, color.g, color.b))
Some(Rgb(color.r, color.g, color.b))
} else {
Some(Fixed(ansi_colours::ansi256_from_rgb((
color.r, color.g, color.b,
Expand Down

0 comments on commit 9cc87f4

Please sign in to comment.