Skip to content

Commit 1e7bad8

Browse files
committed
refactor: Centralizee cargo-update styling
1 parent 367fd9f commit 1e7bad8

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/cargo/ops/cargo_update.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,11 +1058,11 @@ impl PackageChangeKind {
10581058

10591059
pub fn style(&self) -> anstyle::Style {
10601060
match self {
1061-
Self::Added => style::NOTE,
1062-
Self::Removed => style::ERROR,
1063-
Self::Upgraded => style::GOOD,
1064-
Self::Downgraded => style::WARN,
1065-
Self::Unchanged => anstyle::Style::new().bold(),
1061+
Self::Added => style::UPDATE_ADDED,
1062+
Self::Removed => style::UPDATE_REMOVED,
1063+
Self::Upgraded => style::UPDATE_UPGRADED,
1064+
Self::Downgraded => style::UPDATE_DOWNGRADED,
1065+
Self::Unchanged => style::UPDATE_UNCHANGED,
10661066
}
10671067
}
10681068
}

src/cargo/util/style.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ pub const GOOD: Style = AnsiColor::BrightGreen.on_default().effects(Effects::BOL
1212
pub const VALID: Style = AnsiColor::BrightCyan.on_default().effects(Effects::BOLD);
1313
pub const INVALID: Style = annotate_snippets::renderer::DEFAULT_WARNING_STYLE;
1414
pub const TRANSIENT: Style = annotate_snippets::renderer::DEFAULT_HELP_STYLE;
15+
16+
pub const UPDATE_ADDED: Style = NOTE;
17+
pub const UPDATE_REMOVED: Style = ERROR;
18+
pub const UPDATE_UPGRADED: Style = GOOD;
19+
pub const UPDATE_DOWNGRADED: Style = WARN;
20+
pub const UPDATE_UNCHANGED: Style = anstyle::Style::new().bold();

0 commit comments

Comments
 (0)