Skip to content

Commit f959cec

Browse files
committed
use term_color
1 parent f531e6c commit f959cec

10 files changed

+465
-545
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ termcolor = "1.2.0"
262262
thin-vec = "0.2.13"
263263
thiserror = "1.0.37"
264264
tokio = { version = "1.37", features = ["full"] }
265-
tokio_metrics = { version = "0.4.0" }
266265
tokio-postgres = { version = "0.7.8", features = ["with-chrono-0_4"] }
267266
tokio-stream = "0.1.17"
268267
tokio-tungstenite = { version = "0.27.0", features = ["native-tls"] }

crates/schema/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ smallvec.workspace = true
3030
hashbrown.workspace = true
3131
enum-as-inner.workspace = true
3232
enum-map.workspace = true
33-
colored.workspace = true
3433
regex.workspace = true
3534
insta.workspace = true
35+
termcolor.workspace = true
3636

3737
[dev-dependencies]
3838
spacetimedb-lib = { path = "../lib", features = ["test"] }

crates/schema/src/auto_migrate.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use core::{cmp::Ordering, ops::BitOr};
22

33
use crate::{def::*, error::PrettyAlgebraicType, identifier::Identifier};
4-
use ansi_formatter::{AnsiFormatter, ColorScheme};
54
use formatter::format_plan;
65
use spacetimedb_data_structures::{
76
error_stream::{CollectAllErrors, CombineErrors, ErrorStream},
@@ -15,9 +14,9 @@ use spacetimedb_sats::{
1514
layout::{HasLayout, SumTypeLayout},
1615
WithTypespace,
1716
};
18-
mod ansi_formatter;
17+
use term_color_formatter::{ColorScheme, TermColorFormatter};
1918
mod formatter;
20-
mod plain_formatter;
19+
mod term_color_formatter;
2120

2221
pub type Result<T> = std::result::Result<T, ErrorStream<AutoMigrateError>>;
2322

@@ -61,11 +60,11 @@ impl<'def> MigratePlan<'def> {
6160

6261
MigratePlan::Auto(plan) => match style {
6362
NoColor => {
64-
let mut fmt = plain_formatter::PlainFormatter::new(1024);
63+
let mut fmt = TermColorFormatter::new(ColorScheme::default(), termcolor::ColorChoice::Never);
6564
format_plan(&mut fmt, plan).map(|_| fmt.to_string())
6665
}
6766
AnsiColor => {
68-
let mut fmt = AnsiFormatter::new(1024, ColorScheme::default());
67+
let mut fmt = TermColorFormatter::new(ColorScheme::default(), termcolor::ColorChoice::AlwaysAnsi);
6968
format_plan(&mut fmt, plan).map(|_| fmt.to_string())
7069
}
7170
}

0 commit comments

Comments
 (0)