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:
parent
f3a6e073e2
commit
847367f51e
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -1051,8 +1051,8 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "timr"
|
name = "timr-tui"
|
||||||
version = "0.1.0"
|
version = "0.9.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
|
|||||||
12
Cargo.toml
12
Cargo.toml
@ -1,7 +1,15 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "timr"
|
name = "timr-tui"
|
||||||
version = "0.1.0"
|
version = "0.9.0"
|
||||||
|
description = "TUI to organize your time: Pomodoro, Countdown, Timer."
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
rust-version = "1.82.0"
|
||||||
|
homepage = "https://github.com/sectore/timr-tui"
|
||||||
|
repository = "https://github.com/sectore/timr-tui"
|
||||||
|
readme = "README.md"
|
||||||
|
license = "MIT"
|
||||||
|
keywords = ["tui", "timer", "countdown", "pomodoro"]
|
||||||
|
categories = ["command-line-utilities"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ratatui = "0.29.0"
|
ratatui = "0.29.0"
|
||||||
|
|||||||
66
README.md
66
README.md
@ -1,8 +1,6 @@
|
|||||||
# tim:r
|
# timr-tui
|
||||||
|
|
||||||
**Pronounced `/ˈtʌɪmə/` or `/ˈtaɪmər/`.**
|
TUI to organize your time: Pomodoro, Countdown, Timer.
|
||||||
|
|
||||||
`tim:r` is a TUI app to help organize one of the most important thing you might have in live: `time`!
|
|
||||||
|
|
||||||
- `[t]imer` Check the time on anything you are you doing.
|
- `[t]imer` Check the time on anything you are you doing.
|
||||||
- `[c]ountdown` Use it for your workout, yoga session, meditation, handstand or whatever.
|
- `[c]ountdown` Use it for your workout, yoga session, meditation, handstand or whatever.
|
||||||
@ -50,10 +48,12 @@ _Side note:_ Theme colors depend on your terminal preferences.
|
|||||||
<img alt="menu" src="demo/menu.gif" />
|
<img alt="menu" src="demo/menu.gif" />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
# Args ⚙️
|
# CLI
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
Usage: timr [OPTIONS]
|
timr-tui --help
|
||||||
|
|
||||||
|
Usage: timr-tui [OPTIONS]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-c, --countdown <COUNTDOWN> Countdown time to start from. Formats: 'ss', 'mm:ss', or 'hh:mm:ss' [default: 10:00]
|
-c, --countdown <COUNTDOWN> Countdown time to start from. Formats: 'ss', 'mm:ss', or 'hh:mm:ss' [default: 10:00]
|
||||||
@ -68,6 +68,20 @@ Options:
|
|||||||
-V, --version Print version
|
-V, --version Print version
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
From [crates.io](https://crates.io/crates/timr-tui) run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cargo install timr-tui
|
||||||
|
```
|
||||||
|
|
||||||
|
Latest version from git repository:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cargo install --git https://github.com/sectore/timr-tui
|
||||||
|
```
|
||||||
|
|
||||||
# Build from source 🔧
|
# Build from source 🔧
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
@ -121,38 +135,26 @@ nix build .#windows
|
|||||||
|
|
||||||
## Persistant app state
|
## Persistant app state
|
||||||
|
|
||||||
Stored on file system.
|
Stored on file system:
|
||||||
|
|
||||||
- `Linux`
|
|
||||||
```sh
|
```sh
|
||||||
cat ~/.local/state/timr/data/timr.data
|
# Linux
|
||||||
```
|
~/.local/state/timr-tui/data/app.data
|
||||||
|
# macOS
|
||||||
- `macOS`
|
/Users/{user}/Library/Application Support/timr-tui/data/app.data
|
||||||
```sh
|
# Windows
|
||||||
cat /Users/{user}/Library/Application Support/timr/data/timr.data
|
C:/Users/{user}/AppData/Local/timr-tui/data/app.data
|
||||||
```
|
|
||||||
|
|
||||||
- `Windows`
|
|
||||||
```sh
|
|
||||||
cat C:/Users/{user}/AppData/Local/timr/data/timr.data
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Logs
|
## Logs
|
||||||
|
|
||||||
In `debug` mode only.
|
In `debug` mode only. Locations:
|
||||||
|
|
||||||
- `Linux`
|
|
||||||
```sh
|
```sh
|
||||||
tail -f ~/.local/state/timr/logs/timr.log
|
# Linux
|
||||||
```
|
~/.local/state/timr/logs/app.log
|
||||||
|
# macOS
|
||||||
- `macOS`
|
/Users/{user}/Library/Application Support/timr-tui/logs/app.log
|
||||||
```sh
|
# `Windows`
|
||||||
tail -f /Users/{user}/Library/Application Support/timr/logs/timr.log
|
C:/Users/{user}/AppData/Local/timr-tui/logs/app.log
|
||||||
```
|
|
||||||
|
|
||||||
- `Windows`
|
|
||||||
```sh
|
|
||||||
tail -f C:/Users/{user}/AppData/Local/timr/logs/timr.log
|
|
||||||
```
|
```
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
pub static APP_NAME: &str = env!("CARGO_PKG_NAME");
|
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 TICK_VALUE_MS: u64 = 1000 / 10; // 0.1 sec in milliseconds
|
||||||
pub static FPS_VALUE_MS: u64 = 1000 / 60; // 60 FPS in milliseconds
|
pub static FPS_VALUE_MS: u64 = 1000 / 60; // 60 FPS in milliseconds
|
||||||
|
|||||||
@ -6,8 +6,6 @@ use tracing_subscriber::{
|
|||||||
self, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt,
|
self, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::constants::APP_NAME;
|
|
||||||
|
|
||||||
pub struct Logger {
|
pub struct Logger {
|
||||||
log_dir: PathBuf,
|
log_dir: PathBuf,
|
||||||
}
|
}
|
||||||
@ -18,7 +16,7 @@ impl Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn init(&self) -> Result<()> {
|
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 log_file = fs::File::create(log_path)?;
|
||||||
let fmt_layer = tracing_subscriber::fmt::layer()
|
let fmt_layer = tracing_subscriber::fmt::layer()
|
||||||
.with_file(true)
|
.with_file(true)
|
||||||
|
|||||||
@ -22,9 +22,9 @@ use storage::{AppStorage, Storage};
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
let Config { log_dir, data_dir } = Config::init()?;
|
let cfg = Config::init()?;
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
logging::Logger::new(log_dir).init()?;
|
logging::Logger::new(cfg.log_dir).init()?;
|
||||||
|
|
||||||
color_eyre::install()?;
|
color_eyre::install()?;
|
||||||
// get args given by CLI
|
// get args given by CLI
|
||||||
@ -34,7 +34,7 @@ async fn main() -> Result<()> {
|
|||||||
let events = events::Events::new();
|
let events = events::Events::new();
|
||||||
|
|
||||||
// check persistant storage
|
// check persistant storage
|
||||||
let storage = Storage::new(data_dir);
|
let storage = Storage::new(cfg.data_dir);
|
||||||
// option to reset previous stored data to `default`
|
// option to reset previous stored data to `default`
|
||||||
let stg = if args.reset {
|
let stg = if args.reset {
|
||||||
AppStorage::default()
|
AppStorage::default()
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
common::{Content, Style},
|
common::{Content, Style},
|
||||||
constants::APP_NAME,
|
|
||||||
widgets::pomodoro::Mode as PomodoroMode,
|
widgets::pomodoro::Mode as PomodoroMode,
|
||||||
};
|
};
|
||||||
use color_eyre::eyre::Result;
|
use color_eyre::eyre::Result;
|
||||||
@ -65,7 +64,7 @@ impl Storage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_storage_path(&self) -> PathBuf {
|
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<()> {
|
pub fn save(&self, data: AppStorage) -> Result<()> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user