plot/lib/display/
config.rs1use super::{Color, Icon};
2use crate::lib::logic::{ConfigJob, ConfigManifest};
3
4impl std::fmt::Display for ConfigJob {
5 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6 let name = self.name.as_deref().unwrap_or("Brak nazwy");
7 let desc = self.description.as_deref().unwrap_or("Brak opisu");
8
9 let quiet_status = if self.quiet_work { "🔇 (Quiet)" } else { "🔊 (Verbose)" };
10
11 write!(f, "【ID】🔖 [{}] | {} | {}", Color::num(&self.id), Color::folder(name), quiet_status)?;
12 write!(f, "\n 📜 {}", Color::border(desc))?;
13 Ok(())
14 }
15}
16
17impl std::fmt::Display for ConfigManifest {
18 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19 if self.job.is_empty() {
20 return write!(f, "{} Brak zdefiniowanych zadań (jobs) w pliku konfiguracyjnym.", Icon::EMPTY);
21 }
22
23 let mut lines = Vec::new();
24 lines.push("░".repeat(80));
25
26 for job in &self.job {
27 lines.push(job.to_string());
28 }
29
30 write!(f, "{}", lines.join("\n"))
31 }
32}