jobber 0.1.0-alpha

Minimalistic console work time tracker
use derive_more::Deref;
use serde::{Deserialize, Serialize};

#[derive(Deref, Debug, Clone, Default, Serialize, Deserialize)]
pub(crate) struct Color(usize);

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub(crate) struct Tag {
    pub(crate) color: Color,
    pub(crate) description: String,
    pub(crate) deleted: bool,
}

impl Tag {
    pub(crate) fn new(description: String, num_known_tags: usize) -> Self {
        Self {
            color: Color(num_known_tags),
            description,
            deleted: false,
        }
    }
}

impl std::fmt::Display for Tag {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.description)?;
        Ok(())
    }
}