Skip to content

Commit

Permalink
chore: clean up conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
olimorris committed Aug 13, 2023
1 parent 6084d22 commit b4af58d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions scripts/pomodoro.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ intervals_reached() {
return 1
}

# If the user doesn't want to be automatically repeat Pomodoros then we prompt them
prompt_user() {
if [ "$(get_pomodoro_repeat)" == "off" ]; then
return 0
Expand All @@ -156,6 +155,7 @@ skipped_pomodoro() {
fi
return 1
}

skipped_break() {
if [ "$(read_file "$SKIPPED_FILE")" == "break" ]; then
return 0
Expand All @@ -174,8 +174,15 @@ break_length() {
show_intervals() {
show_intervals="$(show_pomodoro_intervals)"
if [ "$show_intervals" != "0" ]; then
printf " $show_intervals" "$(read_file "$INTERVAL_FILE")" "$(get_pomodoro_intervals)"
printf "$show_intervals" "$(read_file "$INTERVAL_FILE")" "$(get_pomodoro_intervals)"
fi
}

is_paused() {
if file_exists "$PAUSED_FILE"; then
return 0
fi
return 1
}

pomodoro_toggle() {
Expand All @@ -191,13 +198,13 @@ pomodoro_toggle() {
return 0
fi

if ! is_being_prompted && file_exists "$START_FILE" && ! file_exists "$PAUSED_FILE"; then
if ! is_being_prompted && file_exists "$START_FILE" && ! is_paused; then
pomodoro_pause
refresh_statusline
return 0
fi

if ! is_being_prompted && file_exists "$PAUSED_FILE"; then
if ! is_being_prompted && is_paused; then
pomodoro_resume
refresh_statusline
return 0
Expand All @@ -211,13 +218,6 @@ pomodoro_pause() {
send_notification "🍅 Pomodoro paused!" "Your Pomodoro has been paused"
}

is_paused() {
if file_exists "$PAUSED_FILE"; then
return 0
fi
return 1
}

pomodoro_resume() {
# Keep a running total of the time paused for
time_paused_for="$(($(get_seconds) - $(read_file "$PAUSED_FILE") + $(read_file "$TIME_PAUSED_FOR_FILE")))"
Expand Down

0 comments on commit b4af58d

Please sign in to comment.