pomodoro.sh: use a hidden directory to store tasks informations.

This commit is contained in:
Jeremy Gardais 2015-10-18 02:11:00 +02:00
parent d340606744
commit c977c43cc4
1 changed files with 11 additions and 2 deletions

View File

@ -3,9 +3,18 @@
TIME=0 TIME=0
# Work on the task (default: 25 min) # Work on the task (default: 25 min)
DELAY=25 DELAY=25
# Log informations
LOG_DIR="${HOME}/.pomodoro"
# Task information (name, path, …) # Task information (name, path, …)
TASK_NAME="${1}" TASK_NAME="${1}"
TASK_PATH="${HOME}/task.todo" TASK_PATH="${LOG_DIR}/current.task"
# Create the log dir
if [ ! -f "${LOG_DIR}" ]; then
touch "${LOG_DIR}"
fi
# Create the task file # Create the task file
if [ ! -f "${TASK_PATH}" ]; then if [ ! -f "${TASK_PATH}" ]; then
@ -15,9 +24,9 @@ fi
# Tiny timer # Tiny timer
while [ "${TIME}" != "${DELAY}" ] while [ "${TIME}" != "${DELAY}" ]
do do
printf '%b' "${TASK_NAME}\n${TIME}" > "${TASK_PATH}"
sleep 60 sleep 60
TIME=$((TIME+1)) TIME=$((TIME+1))
printf '%b' "${TASK_NAME}\n${TIME}" > "${TASK_PATH}"
done done
exit 0 exit 0