Skip to content

Commit

Permalink
chore: remove unmaintained ansi_term in favor of ansiterm
Browse files Browse the repository at this point in the history
  • Loading branch information
kayagokalp committed Nov 6, 2024
1 parent 16318d3 commit 043b661
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 82 deletions.
72 changes: 18 additions & 54 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 @@ -108,7 +108,7 @@ forc-wallet = "0.11"
#

annotate-snippets = "0.10"
ansi_term = "0.12"
ansiterm = "0.12"
anyhow = "1.0"
assert-json-diff = "2.0"
async-trait = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion forc-pkg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license.workspace = true
repository.workspace = true

[dependencies]
ansi_term.workspace = true
ansiterm.workspace = true
anyhow.workspace = true
byte-unit.workspace = true
cid.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions forc-pkg/src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ where
};
println_action_red(
"Removing",
&format!("{}{src}", ansi_term::Style::new().bold().paint(&pkg.name)),
&format!("{}{src}", ansiterm::Style::new().bold().paint(&pkg.name)),
);
}
}
Expand All @@ -372,7 +372,7 @@ where
};
println_action_green(
"Adding",
&format!("{}{src}", ansi_term::Style::new().bold().paint(&pkg.name)),
&format!("{}{src}", ansiterm::Style::new().bold().paint(&pkg.name)),
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions forc-pkg/src/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2244,13 +2244,13 @@ pub fn build_with_options(build_options: &BuildOpts) -> Result<Built> {

fn print_pkg_summary_header(built_pkg: &BuiltPackage) {
let prog_ty_str = forc_util::program_type_str(&built_pkg.tree_type);
// The ansi_term formatters ignore the `std::fmt` right-align
// The ansiterm formatters ignore the `std::fmt` right-align
// formatter, so we manually calculate the padding to align the program
// type and name around the 10th column ourselves.
let padded_ty_str = format!("{prog_ty_str:>10}");
let padding = &padded_ty_str[..padded_ty_str.len() - prog_ty_str.len()];
let ty_ansi = ansi_term::Colour::Green.bold().paint(prog_ty_str);
let name_ansi = ansi_term::Style::new()
let ty_ansi = ansiterm::Colour::Green.bold().paint(prog_ty_str);
let name_ansi = ansiterm::Style::new()
.bold()
.paint(&built_pkg.descriptor.name);
debug!("{padding}{ty_ansi} {name_ansi}");
Expand Down
6 changes: 1 addition & 5 deletions forc-pkg/src/source/git/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,7 @@ impl source::Fetch for Pinned {
if !repo_path.exists() {
println_action_green(
"Fetching",
&format!(
"{} {}",
ansi_term::Style::new().bold().paint(ctx.name),
self
),
&format!("{} {}", ansiterm::Style::new().bold().paint(ctx.name), self),
);
fetch(ctx.fetch_id(), ctx.name(), self)?;
}
Expand Down
6 changes: 1 addition & 5 deletions forc-pkg/src/source/ipfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ impl source::Fetch for Pinned {
if !repo_path.exists() {
println_action_green(
"Fetching",
&format!(
"{} {}",
ansi_term::Style::new().bold().paint(ctx.name),
self
),
&format!("{} {}", ansiterm::Style::new().bold().paint(ctx.name), self),
);
let cid = &self.0;
let ipfs_client = ipfs_client();
Expand Down
4 changes: 2 additions & 2 deletions forc-tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ license.workspace = true
repository.workspace = true

[dependencies]
ansi_term.workspace = true
ansiterm.workspace = true
tracing.workspace = true
tracing-subscriber = { workspace = true, features = ["ansi", "env-filter", "json"] }

[dev-dependencies]
tracing-test = "0.2"
tracing-test = "0.2"
2 changes: 1 addition & 1 deletion forc-tracing/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Utility items shared between forc crates.

use ansi_term::Colour;
use ansiterm::Colour;
use std::str;
use std::{env, io};
use tracing::{Level, Metadata};
Expand Down
2 changes: 1 addition & 1 deletion forc-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository.workspace = true

[dependencies]
annotate-snippets.workspace = true
ansi_term.workspace = true
ansiterm.workspace = true
anyhow.workspace = true
clap = { workspace = true, features = ["cargo", "derive", "env"] }
dirs.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion forc-util/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ macro_rules! cli_examples {


fn help() -> &'static str {
Box::leak(format!("{}\n{}", forc_util::ansi_term::Colour::Yellow.paint("EXAMPLES:"), examples()).into_boxed_str())
Box::leak(format!("{}\n{}", forc_util::ansiterm::Colour::Yellow.paint("EXAMPLES:"), examples()).into_boxed_str())
}

pub fn examples() -> &'static str {
Expand Down
4 changes: 2 additions & 2 deletions forc-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub mod restricted;
#[macro_use]
pub mod cli;

pub use ansi_term;
pub use ansiterm;
pub use paste;
pub use regex::Regex;
pub use serial_test;
Expand Down Expand Up @@ -347,7 +347,7 @@ pub fn print_compiling(ty: Option<&TreeType>, name: &str, src: &dyn std::fmt::Di
};
println_action_green(
"Compiling",
&format!("{ty}{} ({src})", ansi_term::Style::new().bold().paint(name)),
&format!("{ty}{} ({src})", ansiterm::Style::new().bold().paint(name)),
);
}

Expand Down
2 changes: 1 addition & 1 deletion forc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ path = "src/main.rs"

[dependencies]
annotate-snippets.workspace = true
ansi_term.workspace = true
ansiterm.workspace = true
anyhow.workspace = true
clap = { workspace = true, features = ["cargo", "derive", "env"] }
clap_complete.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion forc/src/cli/commands/test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::cli;
use ansi_term::Colour;
use ansiterm::Colour;
use clap::Parser;
use forc_pkg as pkg;
use forc_test::{decode_log_data, TestFilter, TestRunnerCount, TestedPackage};
Expand Down
2 changes: 1 addition & 1 deletion swayfmt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ toml = { workspace = true, features = ["parse"] }

[dev-dependencies]
paste = "1.0"
prettydiff = "0.6"
prettydiff = "0.7"
similar = "2.0"
test-macros = { path = "test_macros" }
2 changes: 1 addition & 1 deletion swayfmt/test_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repository.workspace = true

[dev-dependencies]
paste = "1.0"
prettydiff = "0.6"
prettydiff = "0.7"

[package.metadata.cargo-udeps.ignore]
development = ["paste", "prettydiff"]

0 comments on commit 043b661

Please sign in to comment.