aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlista Kanjo2024-02-13 07:59:27 -0500
committerBlista Kanjo2024-02-13 07:59:27 -0500
commit16d56c9c6727577dcfcf226d1b3d88b75ea0642b (patch)
tree5efde4e367fe6508da436ae763987d7dda61cdcf
parent4ff8f18748a10d796dac56f724aaa1beeda9694c (diff)
refactor: update `posix-pomo`
-rwxr-xr-x.local/bin/posix-pomo24
1 files changed, 5 insertions, 19 deletions
diff --git a/.local/bin/posix-pomo b/.local/bin/posix-pomo
index c5aa0ed..74c72db 100755
--- a/.local/bin/posix-pomo
+++ b/.local/bin/posix-pomo
@@ -9,32 +9,18 @@ keyboard_cancel() {
trap keyboard_cancel INT
# mandatory check for mpv
-if ! command -v mpv >/dev/null 2>&1; then
- echo "error: mpv is a required dependency of posix-pomo — please install mpv to continue."
- exit 1
-fi
+command -v mpv >/dev/null 2>&1 || { echo "error: mpv is a required dependency of posix-pomo — please install mpv to continue."; exit 1; }
# optional checks for fluff files
sound_file=$HOME/.cache/pomo/pomo-sound.mp3
icon_file=$HOME/.cache/pomo/pomo-tomato.png
-if [ ! -f "$sound_file" ]; then
- echo "warning: please provide a sound file at $sound_file"
-fi
-
-if [ ! -f "$icon_file" ]; then
- echo "warning: please provide an icon file at $icon_file"
-fi
-
-if [ ! -f "$sound_file" ] || [ ! -f "$icon_file" ]; then
- echo
-fi
+[ -f "$sound_file" ] || echo "warning: please provide a sound file at $sound_file"
+[ -f "$icon_file" ] || echo "warning: please provide an icon file at $icon_file"
+([ ! -f "$sound_file" ] || [ ! -f "$icon_file" ]) && echo
# show user, usage
-if [ "$#" -ne 2 ]; then
- echo "usage: $0 {work|break} <duration(h/m/s)>"
- exit 1
-fi
+[ "$#" -eq 2 ] || { echo "usage: $0 {work|break} <duration(h/m/s)>"; exit 1; }
mode=$1
input_duration=$2