diff --git a/Cargo.lock b/Cargo.lock index b3660c5a0a..74b18ec454 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -66,15 +66,6 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anstream" version = "0.6.20" @@ -92,9 +83,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" [[package]] name = "anstyle-parse" @@ -3489,7 +3480,7 @@ dependencies = [ name = "nickel-lang-core" version = "0.15.0" dependencies = [ - "ansi_term", + "anstyle", "assert_matches", "bumpalo", "clap", diff --git a/Cargo.toml b/Cargo.toml index 85d5968905..db4678e861 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ lsp-harness = { version = "0.1.0", path = "./lsp/lsp-harness" } # building) but flake.nix needs to be kept in sync. wasm-bindgen = "=0.2.100" -ansi_term = "0.12" +anstyle = "1.0.13" anyhow = "1.0.97" assert_cmd = "2.0.11" assert_matches = "1.5.0" diff --git a/core/Cargo.toml b/core/Cargo.toml index ac18bcbdba..5d38ca3f14 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -23,7 +23,7 @@ bench = false default = ["markdown", "repl", "doc", "format"] clap = ["dep:clap"] markdown = ["dep:termimad"] -repl = ["dep:rustyline", "dep:rustyline-derive", "dep:ansi_term"] +repl = ["dep:rustyline", "dep:rustyline-derive", "dep:anstyle"] repl-wasm = ["dep:wasm-bindgen", "dep:js-sys", "dep:serde_repr", "dep:serde-wasm-bindgen"] doc = ["dep:comrak"] format = ["dep:topiary-core", "dep:topiary-queries", "dep:tree-sitter-nickel"] @@ -63,7 +63,7 @@ unicode-segmentation.workspace = true indoc.workspace = true termimad = { workspace = true, optional = true } -ansi_term = { workspace = true, optional = true } +anstyle = { workspace = true, optional = true } rustyline = { workspace = true, optional = true} rustyline-derive = { workspace = true, optional = true } diff --git a/core/src/repl/mod.rs b/core/src/repl/mod.rs index 3bd16be258..2fef1a29f8 100644 --- a/core/src/repl/mod.rs +++ b/core/src/repl/mod.rs @@ -39,7 +39,7 @@ use crate::{ term::Term, }; #[cfg(feature = "repl")] -use ansi_term::{Colour, Style}; +use anstyle::{AnsiColor, Style}; #[cfg(feature = "repl")] use rustyline::validate::{ValidationContext, ValidationResult}; @@ -375,8 +375,8 @@ impl rustyline::highlight::Highlighter for InputParser { prompt: &'p str, _default: bool, ) -> std::borrow::Cow<'b, str> { - let style = Style::new().fg(Colour::Green); - std::borrow::Cow::Owned(style.paint(prompt).to_string()) + let style = Style::new().fg_color(Some(AnsiColor::Green.into())); + std::borrow::Cow::Owned(format!("{style}{prompt}")) } } diff --git a/core/src/repl/rustyline_frontend.rs b/core/src/repl/rustyline_frontend.rs index 605115520c..c8ae833fde 100644 --- a/core/src/repl/rustyline_frontend.rs +++ b/core/src/repl/rustyline_frontend.rs @@ -5,7 +5,7 @@ use super::{command::Command, *}; use crate::{error::report::ColorOpt, eval::cache::CacheImpl}; -use ansi_term::Style; +use anstyle::Style; use rustyline::{error::ReadlineError, Config, EditMode, Editor}; /// The config of rustyline's editor. @@ -116,7 +116,7 @@ pub fn repl(histfile: Option, color_opt: ColorOpt) -> Result<(), InitEr Ok(()) } Ok(Command::Exit) => { - println!("{}", Style::new().bold().paint("Exiting")); + println!("{}Exiting", Style::new().bold()); break Ok(()); } Err(err) => Err(Error::from(err)), @@ -136,7 +136,7 @@ pub fn repl(histfile: Option, color_opt: ColorOpt) -> Result<(), InitEr }; } Err(ReadlineError::Eof) => { - println!("{}", Style::new().bold().paint("Ctrl+D. Exiting")); + println!("{}Ctrl+D. Exiting", Style::new().bold()); break Ok(()); } Err(ReadlineError::Interrupted) => (),