diff options
Diffstat (limited to 'karlc/src/pretty.rs')
-rw-r--r-- | karlc/src/pretty.rs | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/karlc/src/pretty.rs b/karlc/src/pretty.rs deleted file mode 100644 index ceb1bde..0000000 --- a/karlc/src/pretty.rs +++ /dev/null @@ -1,39 +0,0 @@ -use std::fmt::Display; - -use karlcommon::{Condition, Task}; - -pub struct Pretty<T>(pub T); - -impl Display for Pretty<Task> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_fmt(format_args!( - "- \x1b[4m\x1b[1mTASK {}\x1b[0m - \x1b[38;2;100;255;100mName:\x1b[0m {} - \x1b[38;2;100;255;100mDescription:\x1b[0m {} - \x1b[38;2;100;255;100mOccurence:\x1b[0m {}", - self.0.id, - self.0.name, - self.0.description, - Pretty(self.0.occurence.clone()) - )) - } -} - -impl<T> Display for Pretty<Option<T>> -where - T: Clone, - Pretty<T>: Display, -{ - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match &self.0 { - Some(v) => Pretty(v.clone()).fmt(f), - None => Ok(()), - } - } -} - -impl Display for Pretty<Condition> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_fmt(format_args!("{:?}", self.0)) - } -} |