(args) set content by given duration (#81)

This commit is contained in:
Jens Krause 2025-05-12 12:14:27 +02:00 committed by GitHub
parent c370d3096b
commit 44af71c01c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 2 deletions

View File

@ -1,8 +1,14 @@
# Changelog
## [Unreleased]
### Features
- (args) set `content` by given duration [#81](https://github.com/sectore/tick-tock-tui/pull/81)
## v1.3.0 - 2025-05-06
### Features
###
- (pomodoro) Count WORK rounds [#75](https://github.com/sectore/timr-tui/pull/75), [6b068bb](https://github.com/sectore/timr-tui/commit/6b068bbd094d9ec1a36b47598fadfc71296d9590)
- (pomodoro/countdown) Change initial value [#79](https://github.com/sectore/timr-tui/pull/79), [aae5c38](https://github.com/sectore/timr-tui/commit/aae5c38cd6a666d5ba418b12fb67879a2146b9a2)

View File

@ -92,7 +92,22 @@ impl From<FromAppArgs> for App {
notification: args.notification.unwrap_or(stg.notification),
blink: args.blink.unwrap_or(stg.blink),
app_time_format: stg.app_time_format,
content: args.mode.unwrap_or(stg.content),
// Check args to set a possible mode to start with.
content: match args.mode {
Some(mode) => mode,
// check other args (especially durations)
None => {
if args.work.is_some() || args.pause.is_some() {
Content::Pomodoro
} else if args.countdown.is_some() {
Content::Countdown
}
// in other case just use latest stored state
else {
stg.content
}
}
},
style: args.style.unwrap_or(stg.style),
pomodoro_mode: stg.pomodoro_mode,
pomodoro_round: stg.pomodoro_count,