Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,4 @@ neo4rs = "0.8.0"
bytes = "1.10.1"
rand = "0.9.0"
indoc = "2.0.6"
owo-colors = "4.2.0"
11 changes: 8 additions & 3 deletions src/setup/states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use crate::prelude::*;

use indenter::indented;
use owo_colors::OwoColorize;
use std::fmt::Debug;
use std::fmt::{Display, Write};
use std::hash::Hash;
Expand Down Expand Up @@ -266,6 +267,7 @@ pub struct ResourceSetupInfo<K, S, C: ResourceSetupStatusCheck> {

impl<K, S, C: ResourceSetupStatusCheck> std::fmt::Display for ResourceSetupInfo<K, S, C> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let cyan = (0x5c, 0xe1, 0xe6);
let status_code = match self.status_check.as_ref().map(|c| c.change_type()) {
Some(SetupChangeType::NoChange) => "READY",
Some(SetupChangeType::Create) => "TO CREATE",
Expand All @@ -274,14 +276,17 @@ impl<K, S, C: ResourceSetupStatusCheck> std::fmt::Display for ResourceSetupInfo<
Some(SetupChangeType::Invalid) => "INVALID",
None => "USER MANAGED",
};
writeln!(f, "[ {:^9} ] {}", status_code, self.description)?;
let status_str = format!("[ {:^9} ]", status_code);
let status_full = status_str.truecolor(cyan.0, cyan.1, cyan.2);
let desc_colored = self.description.truecolor(0xff, 0xff, 0xff);
writeln!(f, "{} {}", status_full, desc_colored)?;
if let Some(status_check) = &self.status_check {
let changes = status_check.describe_changes();
if !changes.is_empty() {
let mut f = indented(f).with_str(INDENT);
writeln!(f, "TODO:")?;
writeln!(f, "{}", "TODO:".truecolor(0xae, 0xae, 0xae))?;
for change in changes {
writeln!(f, " - {}", change)?;
writeln!(f, " - {}", change.truecolor(0xae, 0xae, 0xae))?;
}
writeln!(f)?;
}
Expand Down