Skip to content

Commit

Permalink
Minor edits (#99)
Browse files Browse the repository at this point in the history
* fix : END_ROUND_MESSAGE updated

* fix : timer_round set to 1

* doc : repeat section position updated

* doc : CHANGELOG.md updated

* fix : minor bug in run_timer function fixed
  • Loading branch information
sepandhaghighi authored Jul 3, 2024
1 parent 188cbab commit e8527a7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `--repeat` argument
### Changed
- `long-break` program duration changed from `15 minutes` to `30 minutes`
- `README.md` updated
## [1.3] - 2024-05-23
### Added
- 1 new program
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,16 @@ mytimer --minute=7 --second=30 --countdown

```console
mytimer --minute=7 --second=30 --countup
```
```

### Repeat

⚠️ The default value is `1`

```console
mytimer --repeat=3 --second=4
```
* Use `--repeat=-1` for infinite loop

### Alarm

Expand Down Expand Up @@ -162,15 +171,6 @@ mytimer --program=black-tea
mytimer --minute=7 --second=30 --message="Test message"
```

### Repeat

⚠️ The default value is `1`

```console
mytimer --repeat=3 --second=4
```
* Use `--repeat=-1` for infinite loop

<div align="center">

<img src="https://github.com/sepandhaghighi/mytimer/raw/main/otherfiles/help.gif">
Expand Down
17 changes: 7 additions & 10 deletions mytimer/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ def run_timer(args):
elif args.programs_list:
show_programs_list()
else:
timer_round = 0
while timer_round < args.repeat or args.repeat == -1:
timer_round = 1
while timer_round <= args.repeat or args.repeat == -1:
if args.program == "pomodoro":
short_break_params = load_params(args, program="pomodoro-short-break", is_break=True)
long_break_params = load_params(args, program="pomodoro-long-break", is_break=True)
Expand All @@ -475,15 +475,12 @@ def run_timer(args):
two_step_timer(timer_func, params1=params, params2=break_params)
else:
timer_func(**params)

if timer_round < args.repeat - 1:
print_message(
message=END_ROUND_MESSAGE.format(timer_round + 1, args.repeat),
h_shift=params["h_shift"],
confirm=True)
elif args.repeat == -1:
end_round_message = END_ROUND_MESSAGE.format("{0}/{1}".format(timer_round, args.repeat))
if args.repeat == -1:
end_round_message = END_ROUND_MESSAGE.format(timer_round)
if timer_round < args.repeat or args.repeat == -1:
print_message(
message="",
message=end_round_message,
h_shift=params["h_shift"],
confirm=True)
timer_round += 1
2 changes: 1 addition & 1 deletion mytimer/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
INPUT_ERROR_MESSAGE = "[Error] Wrong input"
SOUND_ERROR_MESSAGE = "[Error] Unable to play sound"
EXIT_MESSAGE = "See you. Bye!"
END_ROUND_MESSAGE = "Round {0}/{1} done! Press `Enter` to continue..."
END_ROUND_MESSAGE = "Round {0} done! Press `Enter` to continue..."
NEXT_PROGRAM_MESSAGE = "Press `Enter` to continue (Next: {0})"
PROGRAMS_LIST_TEMPLATE = "{0}. `{1}` - {2}"
TIME_PRINT_TEMPLATE = "{0:02} : {1:02} : {2:02}"
Expand Down

0 comments on commit e8527a7

Please sign in to comment.