Skip to content

Commit

Permalink
Merge pull request #1192 from tmccombs/ansi-term-deprecated
Browse files Browse the repository at this point in the history
Use nu-ansi-term instead of ansi-term
  • Loading branch information
tavianator committed Dec 2, 2022
2 parents 4a66d8f + d441516 commit 6e3eb26
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
33 changes: 20 additions & 13 deletions Cargo.lock

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

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ path = "src/main.rs"
version_check = "0.9"

[dependencies]
ansi_term = "0.12"
nu-ansi-term = "0.46"
argmax = "0.3.1"
atty = "0.2"
ignore = "0.4.3"
Expand All @@ -42,7 +42,6 @@ regex = "1.7.0"
regex-syntax = "0.6"
ctrlc = "3.2"
humantime = "2.1"
lscolors = "0.12"
globset = "0.4"
anyhow = "1.0"
dirs-next = "2.0"
Expand All @@ -57,6 +56,11 @@ faccess = "0.2.4"
version = "4.0.22"
features = ["suggestions", "color", "wrap_help", "cargo", "unstable-grouped", "derive"]

[dependencies.lscolors]
version = "0.13"
default-features = false
features = ["nu-ansi-term"]

[target.'cfg(unix)'.dependencies]
users = "0.11.0"
nix = { version = "0.24.2", default-features = false, features = ["signal"] }
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ fn construct_config(mut opts: Opts, pattern_regexps: &[String]) -> Result<Config

#[cfg(windows)]
let ansi_colors_support =
ansi_term::enable_ansi_support().is_ok() || std::env::var_os("TERM").is_some();
nu_ansi_term::enable_ansi_support().is_ok() || std::env::var_os("TERM").is_some();
#[cfg(not(windows))]
let ansi_colors_support = true;

Expand Down
6 changes: 3 additions & 3 deletions src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn print_trailing_slash<W: Write>(
stdout,
"{}",
style
.map(Style::to_ansi_term_style)
.map(Style::to_nu_ansi_term_style)
.unwrap_or_default()
.paint(&config.actual_path_separator)
)?;
Expand Down Expand Up @@ -85,14 +85,14 @@ fn print_entry_colorized<W: Write>(

let style = ls_colors
.style_for_indicator(Indicator::Directory)
.map(Style::to_ansi_term_style)
.map(Style::to_nu_ansi_term_style)
.unwrap_or_default();
write!(stdout, "{}", style.paint(parent_str))?;
}

let style = entry
.style(ls_colors)
.map(Style::to_ansi_term_style)
.map(Style::to_nu_ansi_term_style)
.unwrap_or_default();
write!(stdout, "{}", style.paint(&path_str[offset..]))?;

Expand Down

0 comments on commit 6e3eb26

Please sign in to comment.