Make status file nicer

This commit is contained in:
felixm 2024-07-10 21:05:57 -04:00
parent d4aa36f9b9
commit d84b83c6d5
2 changed files with 10 additions and 3 deletions

View File

@ -13,3 +13,7 @@ pub const SESSION_PAUSED: &str = "Session is paused. Unpause with 'p'.";
pub const SESSION_STATS_TITLE: &str = "Session Stats";
pub const STATUS_FILE: &str = "~/.antidrift_status";
pub const STATUS_TITLE: &str = "Status";
pub const STATUS_CONFIGURE: &str = "🔄 antidrift configure session";
pub const STATUS_PAUSED: &str = "⏸ antidrift paused";
pub const STATUS_RATE_SESSION: &str = "☑ rate antidrift session!";
pub const STATUS_QUIT: &str = "antidrift shutting down";

View File

@ -145,16 +145,19 @@ impl App {
fn write_status(&self) {
let status = match self.state {
State::InputIntention | State::InputDuration => constants::STATUS_CONFIGURE.to_string(),
State::InProgress => format!(
"{} - {}",
"🎯 {} - {}",
self.user_intention,
duration_as_str(&self.session_remaining)
),
State::Paused => format!(
"antidrift paused - {}",
"{} - {}",
constants::STATUS_PAUSED,
duration_as_str(&self.session_remaining)
),
_ => format!("antidrift inactive"),
State::End => constants::STATUS_RATE_SESSION.to_string(),
State::ShouldQuit => constants::STATUS_QUIT.to_string(),
};
let path = shellexpand::tilde(constants::STATUS_FILE).to_string();