Prepare publish (#39)

* refactor!: rename `.data` and `.log` files
   - `timr.data` -> `app.data`
   - `timr.log` -> `app.log`
* refactor!: rename app name `timr` -> `timr-tui`
* docs: update README (paths, names, installation)
* update Cargo.toml
* fix(release): warning: unused variable: `log_dir`
This commit is contained in:
Jens K.
2025-01-02 12:16:56 +01:00
committed by GitHub
parent f3a6e073e2
commit 847367f51e
7 changed files with 51 additions and 45 deletions

View File

@@ -1,5 +1,4 @@
pub static APP_NAME: &str = env!("CARGO_PKG_NAME");
// TODO: Grab those values from `Args`
pub static TICK_VALUE_MS: u64 = 1000 / 10; // 0.1 sec in milliseconds
pub static FPS_VALUE_MS: u64 = 1000 / 60; // 60 FPS in milliseconds

View File

@@ -6,8 +6,6 @@ use tracing_subscriber::{
self, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt,
};
use crate::constants::APP_NAME;
pub struct Logger {
log_dir: PathBuf,
}
@@ -18,7 +16,7 @@ impl Logger {
}
pub fn init(&self) -> Result<()> {
let log_path = self.log_dir.join(format!("{}.log", APP_NAME));
let log_path = self.log_dir.join("app.log");
let log_file = fs::File::create(log_path)?;
let fmt_layer = tracing_subscriber::fmt::layer()
.with_file(true)

View File

@@ -22,9 +22,9 @@ use storage::{AppStorage, Storage};
#[tokio::main]
async fn main() -> Result<()> {
let Config { log_dir, data_dir } = Config::init()?;
let cfg = Config::init()?;
#[cfg(debug_assertions)]
logging::Logger::new(log_dir).init()?;
logging::Logger::new(cfg.log_dir).init()?;
color_eyre::install()?;
// get args given by CLI
@@ -34,7 +34,7 @@ async fn main() -> Result<()> {
let events = events::Events::new();
// check persistant storage
let storage = Storage::new(data_dir);
let storage = Storage::new(cfg.data_dir);
// option to reset previous stored data to `default`
let stg = if args.reset {
AppStorage::default()

View File

@@ -1,6 +1,5 @@
use crate::{
common::{Content, Style},
constants::APP_NAME,
widgets::pomodoro::Mode as PomodoroMode,
};
use color_eyre::eyre::Result;
@@ -65,7 +64,7 @@ impl Storage {
}
fn get_storage_path(&self) -> PathBuf {
self.data_dir.join(format!("{}.data", APP_NAME))
self.data_dir.join("app.data")
}
pub fn save(&self, data: AppStorage) -> Result<()> {