diff --git a/pomodoro.sh b/pomodoro.sh index d168997..ab5627d 100755 --- a/pomodoro.sh +++ b/pomodoro.sh @@ -3,7 +3,8 @@ TIME=0 # Work on the task (default: 25 min) WORK_TIME=25 -BREAK_TIME=5 +SHORT_BREAK_TIME=5 +LONG_BREAK_TIME=20 # Log informations LOG_DIR="${HOME}/.pomodoro" @@ -14,20 +15,27 @@ LOG_TASK_PATH="${LOG_DIR}/${LOG_TASK_NAME}" TASK_NAME="${1}" TASK_PATH="${LOG_DIR}/current.task" -# Create the log dir -if [ ! -f "${LOG_DIR}" ]; then - mkdir -p -- "${LOG_DIR}" -fi +initialize() { -# Create the task file -if [ ! -f "${TASK_PATH}" ]; then - touch "${TASK_PATH}" -fi + # Create the log dir + if [ ! -d "${LOG_DIR}" ]; then + mkdir -p -- "${LOG_DIR}" + fi -# Create the task log file -if [ ! -f "${LOG_TASK_PATH}" ]; then - touch "${LOG_TASK_PATH}" -fi + # Create the task file + if [ ! -f "${TASK_PATH}" ]; then + touch "${TASK_PATH}" + fi + + # Create the task log file + if [ ! -f "${LOG_TASK_PATH}" ]; then + touch "${LOG_TASK_PATH}" + fi +} + +# ------------- START ------------- + +initialize # Start working startedTime=$(date +"%H:%M") @@ -45,6 +53,7 @@ done printf '%b' "$(date +"%A (%F) $startedTime → %H:%M") $TASK_NAME" >> "${LOG_TASK_PATH}" # Start break +BREAK_TIME=${SHORT_BREAK_TIME} printf '%b' "BREAK\n${BREAK_TIME}" > "${TASK_PATH}" while [ "${BREAK_TIME}" > 0 ]; do