Skip to content

Commit 88c86e4

Browse files
committed
use term_color
1 parent f531e6c commit 88c86e4

9 files changed

+465
-546
lines changed

Cargo.lock

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

crates/schema/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ smallvec.workspace = true
3030
hashbrown.workspace = true
3131
enum-as-inner.workspace = true
3232
enum-map.workspace = true
33-
colored.workspace = true
34-
regex.workspace = true
3533
insta.workspace = true
34+
termcolor.workspace = true
3635

3736
[dev-dependencies]
3837
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)