Skip to content

Commit f8fb0a0

Browse files
committed
Migrate from the term crate to termcolor
The API of `termcolor` fits what the system gives us much more nicely and should be well battle-tested from ripgrep. Additionally we don't really need huge terminfo parsers, that wasn't every really the intention of the color support here.
1 parent 45148e0 commit f8fb0a0

File tree

20 files changed

+165
-477
lines changed

20 files changed

+165
-477
lines changed

Cargo.lock

Lines changed: 15 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ serde_json = "1.0"
4444
shell-escape = "0.1"
4545
tar = { version = "0.4", default-features = false }
4646
tempdir = "0.3"
47-
term = "0.4.4"
47+
termcolor = "0.3"
4848
toml = "0.4"
4949
url = "1.1"
5050

src/bin/cargo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::env;
1515
use std::fs;
1616
use std::path::{Path, PathBuf};
1717

18-
use cargo::core::shell::{Verbosity, ColorConfig};
18+
use cargo::core::shell::{Shell, Verbosity};
1919
use cargo::util::{self, CliResult, lev_distance, Config, CargoResult, CargoError, CargoErrorKind};
2020
use cargo::util::CliError;
2121

@@ -75,7 +75,7 @@ fn main() {
7575
let config = match Config::default() {
7676
Ok(cfg) => cfg,
7777
Err(e) => {
78-
let mut shell = cargo::shell(Verbosity::Verbose, ColorConfig::Auto);
78+
let mut shell = Shell::new();
7979
cargo::exit_with_error(e.into(), &mut shell)
8080
}
8181
};

src/bin/read_manifest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Options:
2929
pub fn execute(options: Options, config: &Config) -> CliResult {
3030
debug!("executing; cmd=cargo-read-manifest; args={:?}",
3131
env::args().collect::<Vec<_>>());
32-
config.shell().set_color_config(options.flag_color.as_ref().map(|s| &s[..]))?;
32+
config.shell().set_color_choice(options.flag_color.as_ref().map(|s| &s[..]))?;
3333

3434
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
3535

src/cargo/core/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub use self::package_id::PackageId;
66
pub use self::package_id_spec::PackageIdSpec;
77
pub use self::registry::Registry;
88
pub use self::resolver::Resolve;
9-
pub use self::shell::{Shell, MultiShell, ShellConfig, Verbosity, ColorConfig};
9+
pub use self::shell::{Shell, Verbosity};
1010
pub use self::source::{Source, SourceId, SourceMap, GitReference};
1111
pub use self::summary::Summary;
1212
pub use self::workspace::{Workspace, WorkspaceConfig};

0 commit comments

Comments
 (0)