diff --git a/README.md b/README.md index 1358f47..b0e71eb 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,17 @@ Contents # arttime -🧜🏼‍♀️ Beauty of text art meets functionality of clock/timer ⏰. ``arttime`` brings curated text-art to otherwise artless terminal emulators of starving developers and other users who can use terminal. +🧜🏼‍♀️ Beauty of text art meets functionality of a feature-rich clock/timer/pattern-based time manager ⏰. ``arttime`` brings curated text-art to otherwise artless terminal emulators of starving developers and other users who can use terminal. ## Purpose/features - Bring curated text/ascii art to artless terminals, currently 300+ high-quality text art to choose from -- Provide a simple yet smart alarm/timer for commandline. Always shows some delta in time, which is hard to track by looking outside the window or looking at your phone/computer clock. Provides easy/interative timezone switching. +- Provide a feature-rich alarm timer/time manager for commandline. + - Set multiple timers, supports specifying delta in time (like ``1h 30m`` from now) or absoulte time (like ``Dec 22 2:45PM EST``). + - Configurable pattern-based time management: Set a repeating pattern of times to get notifications at. This makes [Pomodoro Technique](https://en.wikipedia.org/wiki/Pomodoro_Technique) just one of billions of patterns possible for time management, and makes you set a pattern that works for you. + - Or just loop forever or N number of times over a set of timers. Example: get a notification every day at 8AM; 12PM; 5PM. + - Shows time passed since a timer expired or times pending to for every timer (press ``i`` after setting multiple goals) + - Always shows some delta in time which is hard to track: 1) time since arttime started, 2) time pending for next timer, 3) time passed since last timer expired. + - Interactively switch time zones. - Native desktop notifications for timer, notification identifies the instance of arttime it came from - Provide users with 1 line of text under art to share their mind, display their activism - Support animated text art: flip-flop between two related ascii arts every second @@ -49,7 +55,7 @@ Much good ascii art was created during web 1.0, but the artform declined after t # Screenshots 1. Default start page. ``$ arttime`` -Screen Shot 2022-06-02 at 2 58 07 PM +help_learn_page 2. Default art. ``$ arttime`` then press ``h``, or ``arttime --nolearn`` Screen Shot 2022-05-21 at 10 17 59 PM @@ -63,17 +69,20 @@ Much good ascii art was created during web 1.0, but the artform declined after t 5. Timer and notification. ``arttime --nolearn -a colorowl2 -b colorowl3 -t "We don't sleep at night - Owls"`` then press ``g`` to enter a goal time like ``6s`` for 6 seconds, ``1h 6s`` for 1 hour 6 seconds. Check more formats supported by reading help documentation ``$ arttime -h``, or even better by passing 'help' as goal time while arttime is running (press ``g``, enter ``help``). This is an example of multi-colored art too. ![arttime_timer2](https://user-images.githubusercontent.com/71736629/169683033-b343526c-718a-4515-a1fa-52943a609e18.gif) -6. Activism and 24-bit ANSI color example ``$ arttime --nolearn -a ukraine1_40 -t "Support peace, support Ukraine"``. Note: terminal emulator must support 24-bit RGB colors. +6. Multiple timers, repeating time management program like [Pomodoro Technique](https://en.wikipedia.org/wiki/Pomodoro_Technique). a) From the commandline, run: ``arttime --nolearn -a magic -b magic2 -g "25m;30m;55m;1h;1h25m;1h30m;1h55m;2h25m;loop"`` or b) From within application, run: ``arttime --nolearn -a magic -b magic2``, then press ``g`` and enter ``25m;30m;55m;1h;1h25m;1h30m;1h55m;2h25m;loop``. Change ``loop`` to ``loop4`` or ``sprint4`` for approximately 10 hour work day. +Screen Shot 2022-06-19 at 6 06 39 PM + +7. Activism and 24-bit ANSI color example ``$ arttime --nolearn -a ukraine1_40 -t "Support peace, support Ukraine"``. Note: terminal emulator must support 24-bit RGB colors. Screen Shot 2022-05-22 at 12 05 56 AM -7. Another 24-bit ANSI color (from image) example ``$ arttime --nolearn -a obama2 -t "Yes we can, yes we can drink better teas"``. Note: terminal emulator must support 24-bit RGB colors. +8. Another 24-bit ANSI color (from image) example ``$ arttime --nolearn -a obama2 -t "Yes we can, yes we can drink better teas"``. Note: terminal emulator must support 24-bit RGB colors. Screen Shot 2022-05-22 at 12 14 22 AM -8. Random art selection game, tarot-style. ``$ arttime --nolearn`` then press and hold ``j`` for a few seconds. After some time arttime will settle on some randomly selected art. Press ``y`` to select it, or ``c`` to cancel. Click on mp4 video below to play it (Note: following video playback works in Safari on macOS, but for some reason not in Safari on iPhone 8, perhaps because of a github.com bug?). +9. Random art selection game, tarot-style. ``$ arttime --nolearn`` then press and hold ``j`` for a few seconds. After some time arttime will settle on some randomly selected art. Press ``y`` to select it, or ``c`` to cancel. Click on mp4 video below to play it (Note: following video playback works in Safari on macOS, but for some reason not in Safari on iPhone 8, perhaps because of a github.com bug?). https://user-images.githubusercontent.com/71736629/169684098-1f44732c-92fd-466a-84b3-8e69affdf64f.mp4 -9. And much more... For more information read help documentation ``$ arttime -h``, and start in learn mode (default) to understand keybindings ``$ arttime``. +10. And much more... For more information read help documentation ``$ arttime -h``, and start in learn mode (default) to understand keybindings ``$ arttime``. # Installation At the moment, only manual installation is possible, but it's very simple as the code is self-contained. diff --git a/bin/arttime b/bin/arttime index 3a81046..f75d5d4 100755 --- a/bin/arttime +++ b/bin/arttime @@ -274,12 +274,26 @@ tzshortcurrent="$tzshort" # Function to push desktop notifications function notifydesktop { local notifytitle="ARTTIME" - local notifysubtitle="$(strftime '%b %d, %Y %I:%M:%S%p %Z')" - local notifymessage="Goal $goal reached!\ra-art: $(getaart)" + local notifysubtitle="$(strftime '%a %b %d, %Y %I:%M:%S%p %Z')" + if [[ $printsprints = "1" ]]; then + if [[ $goalmaxsprint != "-" ]]; then + local notifymessage="sprint-$goalsprint/$goalmaxsprint" + else + local notifymessage="sprint-$goalsprint" + fi + else + local notifymessage="" + fi + if [[ $goalmaxptreff -gt 1 ]]; then + local goalptrofmaxstr="-$goalptr/$goalmaxptreff" + else + local goalptrofmaxstr="" + fi + notifymessage+=" goal$goalptrofmaxstr: $goalstr" if bart=$(getbart); then - notifymessage+=", b-art: $(getbart)" + notifymessage+="\rarts: $(getaart), $(getbart)" else - notifymessage+=", b-art: none" + notifymessage+="\rart: $(getaart)" fi notifymessage+="\rID: $$" if [[ $machine = "Darwin" ]]; then @@ -407,7 +421,6 @@ tput -S </dev/null); then if [[ $goaltime -gt $currenttime ]]; then - tput cup 0 0 - tput el - printf "Today's $goal has passed, setting goal time to tomorrow's $goal" - sleep 2 + goalstatus="1" + #tput cup 0 0 + #tput el + #printf "Today's $goal has passed, setting goal time to tomorrow's $goal" + #sleep 2 else - goaltime="" + goaltime='-' + goalstatus="2" fi fi else - goaltime="" + goaltime='-' + goalstatus="2" fi #echo "$ goal:$goal, goaltime:$goaltime" - if [[ ! -z $goaltime ]]; then + if [[ $goaltime != '-' ]]; then local tmpgoaltime=$(strftime $timeformat $goaltime) local tmpgoaltimearray=(${(s/|/)tmpgoaltime}) goaltimestr=$tmpgoaltimearray[2] @@ -477,20 +496,136 @@ function setgoaltime { else goaltimestr="" fi + returngoaltime="$goaltime" + returngoaltimestr="$goaltimestr" + returngoalstatus="$goalstatus" + #return $returnval #echo "$ goal:$goal, goaltime:$goaltime, goaltimestr:$goaltimestr" } +#goaltimes=() +#goaltimesstrs=() +#goalvalids=() +goalarray=() +goalarraysorted=() +goalentry="" +goalsprint="1" + +function setnextgoal { + if [[ $goalptr != $goalmaxptr ]] then; + local lastgoaltime="$goaltime" + local lastgoaltimestr="$goaltimestr" + goalptr=$((goalptr+1)) + goalentry="$goalarraysorted[$goalptr]" + #$returngoaltime;$numgoals;$returngoalstatus;$returngoaltimestr;$goal + local goalentryarray=(${(s/;/)goalentry}) + goaltime="$goalentryarray[1]" + goalnum="$goalentryarray[2]" + local localgoalnum="$goalnum" + goalstatus="$goalentryarray[3]" + goaltimestr="$goalentryarray[4]" + local localgoaltimestr="$goaltimestr" + goalstr="$goalentryarray[5]" + if [[ $goalstr = "loop" ]]; then + if [[ $localgoaltimestr = "-" ]]; then + local lastgoalptr="$goalptr" + goalsprint=$((goalsprint+1)) + setgoals + goaldone="0" + #goalarraysorted[-1]=("loop;$localgoalnum;0;-;loop") + elif [[ $localgoaltimestr -gt 1 ]]; then + local lastgoalptr="$goalptr" + goalsprint=$((goalsprint+1)) + setgoals + goaldone="0" + goalarraysorted[-1]=("loop;$localgoalnum;0;$((localgoaltimestr-1));loop") + else + goaltime="$lastgoaltime" + goaltimestr="$lastgoaltimestr" + goalptr="$((goalmaxptr-1))" + goaldone="1" + fi + else + goaldone="0" + fi + fi +} + +function setgoals { + goalmaxptr="0" + goalptr="0" + local tmpgoals=(${(s/;/)goal}) + local goal="" + local numgoals="0" + local errdetected="0" + local tmpgoalarray=() + for goal in "$tmpgoals[@]"; do + numgoals=$((numgoals+1)) + if [[ $goal =~ ^[[:space:]]*(loop|sprint|x)(.*)$ ]]; then + goal="loop" + local match2="$match[2]" + if [[ $match2 =~ ^([0-9]+)[[:space:]]*$ ]]; then + returngoaltimestr="$match[1]" + elif [[ $match2 =~ ^[[:space:]]*$ ]]; then + returngoaltimestr="-" + else + returngoaltimestr=" " + errdetected="1" + fi + if [[ $numgoals = "1" ]]; then + errdetected="1" + fi + returngoaltime="loop" + tmpgoalarray+=("$returngoaltime;$numgoals;0;$returngoaltimestr;$goal") + break + else + #[[ $goal =~ ^[[:space:]]*(.*)$ ]] && goal="$match[1]" + goal=${${goal%${goal##*[^[:blank:]]}}#${${goal%${goal##*[^[:blank:]]}}%%[^[:blank:]]*}}; + setgoaltime $goal $(strftime '%s') + if [[ $returngoalstatus = "2" ]]; then + errdetected="1" + fi + tmpgoalarray+=("$returngoaltime;$numgoals;$returngoalstatus;$returngoaltimestr;$goal") + fi + done + if [[ $numgoals -gt 0 ]]; then + if [[ $errdetected = "0" ]]; then + goalarray=("${tmpgoalarray[@]}") + goalarraysorted=("${(o)goalarray[@]}") + errgoalarray=() + goalptr="0" + goalmaxptr="$numgoals" + setnextgoal + else + errgoalarray=("${tmpgoalarray[@]}") + goalptr="0" + goalmaxptr="0" + goalentry="" + goaltime="" + fi + fi + return $errdetected +} + if [[ ! -z $goal ]]; then - setgoaltime - if [[ -z $goaltime ]]; then - echo "Err: Goal time must be a valid time format representing future time" + setgoals + if [[ "$?" != "0" ]]; then + echo "E: Goal time must be a valid time format representing future time.\n Start application, press 'g', enter 'help' to learn more." exit 0 + else + if [[ $returngoaltime = "loop" && ( $returngoaltimestr = "-" || $returngoaltimestr =~ ^[0-9]+$ ) ]]; then + printsprints="1" + goalmaxptreff="$((goalmaxptr-1))" + goalmaxsprint="$returngoaltimestr" + else + printsprints="0" + goalmaxptreff="$goalmaxptr" + fi fi else goaltime="" fi - if [[ ! -z $updateonminute ]]; then sleeptime="60" nonblocking="1" @@ -613,13 +748,15 @@ function setartstring { tput_cup00=$(tput cup 0 0) tput_sc=$(tput sc) tput_rc=$(tput rc) +tput_civis=$(tput civis) +tput_smcup=$(tput smcup) -toggleflipart="" +toggleflipart="0" function printart { usr1detected="" trap 'trapusr1detected' USR1 - if [[ ! -z $flipartname && ! -z $toggleflipart ]]; then - toggleflipart="" + if [[ ! -z $flipartname && $toggleflipart = "1" ]]; then + toggleflipart="0" if [[ -z $1 ]]; then printf '%s\n' "${tput_cup00}${flipartstring}" else @@ -684,14 +821,53 @@ function printtime { slackstring4="$goaltimestr" if [[ ! $difftime -gt 0 ]]; then difftime=$(( -difftime )) - slackstring1=" | goal passed! " - slackstring4style="$passedgoalstyle" - if [[ ! -z $goal ]]; then - notifydesktop - goal="" + if [[ $goaldone = "0" ]]; then + local lastgoaltime="$goaltime" + while ((goaltime == lastgoaltime && goaldone == 0)); do + notifydesktop & + goaldone="1" + setnextgoal + done + difftime=$((goaltime-currenttimearray[1])) + slackstring4="$goaltimestr" + fi + if [[ $goalmaxptreff -gt 1 ]]; then + local goalptrofmaxstr="-$goalptr/$goalmaxptreff" + else + local goalptrofmaxstr="" + fi + if [[ $printsprints = "1" ]]; then + if [[ $goalmaxsprint != "-" ]]; then + slackstring1=" | sprint-${goalsprint}/$goalmaxsprint " + else + slackstring1=" | sprint-${goalsprint} " + fi + else + slackstring1=" | " + fi + if [[ $goaldone = "0" ]]; then + slackstring1+="goal$goalptrofmaxstr pending " + slackstring4style="" + else + slackstring1+="goal$goalptrofmaxstr passed! " + slackstring4style="$passedgoalstyle" fi else - slackstring1=" | time pending " + if [[ $goalmaxptreff -gt 1 ]]; then + local goalptrofmaxstr="-$goalptr/$goalmaxptreff" + else + local goalptrofmaxstr="" + fi + if [[ $printsprints = "1" ]]; then + if [[ $goalmaxsprint != "-" ]]; then + slackstring1=" | sprint-${goalsprint}/$goalmaxsprint " + else + slackstring1=" | sprint-${goalsprint} " + fi + else + slackstring1=" | " + fi + slackstring1+="goal$goalptrofmaxstr pending " slackstring4style="" fi else @@ -866,18 +1042,47 @@ zstyle ':completion:zoneselector:*:' completer _zoneselector zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' autoload -Uz compinit && compinit +function formattimedelta { + if [[ ! $1 -gt 0 ]]; then + local timedelta="$1" + local timedelta=$(( -timedelta )) + local timestate=" passed: " + else + local timedelta="$1" + local timestate="pending: " + fi + local days=$(($timedelta/86400)) + local hours=$(($timedelta%86400/3600)) + local minutes=$(($timedelta%3600/60)) + local seconds=$(($timedelta%60)) + if [[ $days != "0" || $2 != "0" ]]; then + if [[ $2 != "0" ]]; then + local formattedtime="${(l:$2::0:)days}d " + else + local formattedtime="${days}d " + fi + else + local formattedtime="" + fi + formattedtime="$formattedtime${(l:2::0:)hours}h " + formattedtime="$formattedtime${(l:2::0:)minutes}m " + if [[ -z $updateonminute ]]; then + formattedtime="$formattedtime${(l:2::0:)seconds}s" + fi + echo "$timestate$formattedtime" +} + function usr1input_handler { case "$1" in "a"|"b") $sttycmd $sttyorig - tput smcup + printf "$tput_smcup" tput cup 0 0 tput cnorm clear artselector $sttycmd -echo $sttycmd -icanon min 0 time 0 - tput rmcup tputset if [[ $tmpartname = "" ]]; then if [[ $1 = "b" ]]; then @@ -997,20 +1202,38 @@ function usr1input_handler { #"d") # echo "cliwallpaper[$$]: flipartname=$flipartname, lasttime=$lasttime, toggleflipart:$toggleflipart, artname:$artname, flipartht:$flipartht, artht:$artht, artstringht:$artstringht, flipartstringht:$flipartstringht" >> ~/arttime_debug.log # ;; + "e") + if [[ ! -z $goal ]]; then + $sttycmd $sttyorig + tput cnorm + if askforconfirmation "restart previous goal '$goal'"; then + goalsprint="1" + setgoals + fi + $sttycmd -echo + $sttycmd -icanon min 0 time 0 + tput civis + else + echo "No goals set, so nothing to restart" + zselect -t 200 + while read dummy ; do : ; done + fi + ;; "g") tput cup 0 0 tput el tempgoal="" $sttycmd $sttyorig tput cnorm - printf "Enter goal ('help' to learn): " - read tempgoal + toggleflipart=$(((toggleflipart+1)%2)) + vared -p "$(printart;lasttime="";printtime '1')${tput_cup00}Enter goal ('help' to learn): " -c tempgoal; + printf "$tput_civis" $sttycmd -echo $sttycmd -icanon min 0 time 0 - tput civis if [[ ! -z $tempgoal ]]; then goal="$tempgoal" - setgoaltime + goalsprint="1" + setgoals if [[ -z $goaltime ]]; then if [[ -z $datehelpstr ]]; then if [[ $dateisgnu = "1" ]]; then @@ -1023,7 +1246,14 @@ arttime supports two types of time formats: 1) Native, 2) External. External formats are enabled by GNU date, which is INSTALLED on your system, and should be preferred (as they can be very expressive). -1) Native (simple, relative): +One can set multiple goals, and even sprint (loop) over a pattern of goals +multiple times. Multiple goals or a pattern of goals can be specified by +separating them with a semi-colon (;). Goals can be repeated by specifying +the last goal as 'loop'/'sprint' (to sprint forever) or 'loopN'/'sprintN' +(to sprint N number of times). See section 3) below to learn how to set +multiple goals, and/or a pattern of goals to repeat. + +1) Native (simple, relative) formats: 1m (1 minute from now) 30s (30 seconds from now) 48h (48 hours from now) @@ -1035,7 +1265,7 @@ system, and should be preferred (as they can be very expressive). Native format can have any of: Ad Bh Cm Ds, where A/B/C/D are numbers. -2) External (simple/complex, absolute/relative, very expressive): +2) External (simple/complex, absolute/relative, very expressive) formats: 10AM (upcoming 10AM, local timezone unless specified) 10:30AM IST (upcoming 10:30AM Indian Standard Time) May 26 10:30AM IST (10:30AM on May 26 in Indian Standard Time) @@ -1052,6 +1282,15 @@ For detailed documentation on External date/time formats please refer: Web: https://www.gnu.org/software/coreutils/date Locally: $ info '(coreutils) date invocation' and jump directly to the section on "Date input formats". + +3) Multiple and/or pattern of repeating goals: + 10s;20s (10 seconds and 20 seconds from now) + 10s;20s;1PM (10 seconds and 20 seconds from now, at 1PM in local time zone) + 10s;loop, 10s;sprint (every 10 seconds, repeat forever) + 10s;loop4, 10s;sprint4 (after 10 seconds, sprint 4 times) + 10s;1m;loop2 (after 10 seconds and 1m from now, sprint 2 times) + 5m;1PM;2PM;3PM;4PM;loop (after 5m from now and at 1-4 PM, repeat forever) + 25m;30m;55m;1h;1h25m;1h30m;1h55m;2h25m;loop (pattern of Pomodoro Technique) EOF else read -r -d '' datehelpstr <<-'EOF' @@ -1065,7 +1304,14 @@ please search the web to find if/how to install GNU date on your system. If installed, it will open up the possibility of being very expressive in specifying goal date/time. After installing GNU date, restart arttime. -1) Native (simple, relative, should work on your system): +One can set multiple goals, and even sprint (loop) over a pattern of goals +multiple times. Multiple goals or a pattern of goals can be specified by +separating them with a semi-colon (;). Goals can be repeated by specifying +the last goal as 'loop'/'sprint' (to sprint forever) or 'loopN'/'sprintN' +(to sprint N number of times). See section 3) below to learn how to set +multiple goals, and/or a pattern of goals to repeat. + +1) Native (simple, relative, should work on your system) formats: 1m (1 minute from now) 30s (30 seconds from now) 48h (48 hours from now) @@ -1077,7 +1323,7 @@ specifying goal date/time. After installing GNU date, restart arttime. Native format can have any of: Ad Bh Cm Ds, where A/B/C/D are numbers. -2) External (very expressive, though won't work on your system): +2) External (very expressive, though won't work on your system) formats: 10AM (upcoming 10AM, local timezone unless specified) 10:30AM IST (upcoming 10:30AM Indian Standard Time) May 26 10:30AM IST (10:30AM on May 26 in Indian Standard Time) @@ -1094,12 +1340,30 @@ For detailed documentation on External date/time formats please refer: Web: https://www.gnu.org/software/coreutils/date Locally: $ info '(coreutils) date invocation' and jump directly to the section on "Date input formats". + +3) Multiple and/or pattern of repeating goals: + 10s;20s (10 seconds and 20 seconds from now) + 10s;20s;1PM (10 seconds and 20 seconds from now, at 1PM in local time zone) + 10s;loop, 10s;sprint (every 10 seconds, repeat forever) + 10s;loop4, 10s;sprint4 (after 10 seconds, sprint 4 times) + 10s;1m;loop2 (after 10 seconds and 1m from now, sprint 2 times) + 5m;1PM;2PM;3PM;4PM;loop (after 5m from now and at 1-4 PM, repeat forever) + 25m;30m;55m;1h;1h25m;1h30m;1h55m;2h25m;loop (pattern of Pomodoro Technique) EOF fi fi clear less -R <<<"$datehelpstr" 2>/dev/null tput smcup + else + if [[ $returngoaltime = "loop" && ( $returngoaltimestr = "-" || $returngoaltimestr =~ ^[0-9]+$ ) ]]; then + printsprints="1" + goalmaxptreff="$((goalmaxptr-1))" + goalmaxsprint="$returngoaltimestr" + else + printsprints="0" + goalmaxptreff="$goalmaxptr" + fi fi fi ;; @@ -1127,27 +1391,70 @@ EOF read -t3 -k1 fi ;; - "i") + "i"|"I") local tmpcurtime=$(strftime '%s') - local timestring="$(strftime '%b %d, %Y %I:%M:%S%p %Z')" - timestring+=" ($tzlongcurrent)" - timestring+="$(strftime ' | week %W')" - timestring+=" | ID: $$" + local infostring="$(strftime '%a %b %d, %Y %I:%M:%S%p %Z')" + infostring+=" ($tzlongcurrent)" + infostring+="$(strftime ' | week %W')" + infostring+=" | ID: $$ " if [[ $helpactive = "1" ]]; then if [[ $restoreflipartname != "" ]]; then - printf "$timestring \na-art: $restoreartname, b-art: $restoreflipartname" + infostring+=" \narts: a) $restoreartname, b) $restoreflipartname " else - printf "$timestring \na-art: $restoreartname, b-art: none" + infostring+=" \narts: a) $restoreartname, b) none " fi else if [[ $flipartname != "" ]]; then - printf "$timestring \na-art: $artname, b-art: $flipartname" + infostring+=" \narts: a) $artname, b) $flipartname " + else + infostring+=" \narts: a) $artname, b) none " + fi + fi + if [[ ! -z $goaltime && $goaldone = "0" ]]; then + infostring+="\nGoals: " + # NOTE: first query the last entry to find width of days + local goalentryarray=(${(s/;/)goalarraysorted[$goalmaxptreff]}) + local goaltimeunix="$goalentryarray[1]" + local timepending=$((goaltimeunix-currenttimearray[1])) + timepending=$((timepending/86400)) + if [[ $timepending != "0" ]]; then + local datewidth="${#timepending}" else - printf "$timestring \na-art: $artname, b-art: none" + local datewidth="0" fi + for ((i=1;i<=goalmaxptr;i=i+1)) do + #$returngoaltime;$numgoals;$returngoalstatus;$returngoaltimestr;$goal + goalentryarray=(${(s/;/)goalarraysorted[$i]}) + local goalnum="$goalentryarray[2]" + local goalstatus="$goalentryarray[3]" + local goalstr="$goalentryarray[5]" + if [[ $goalstr != "loop" ]]; then + goaltimeunix="$goalentryarray[1]" + local goaltimestr=$(strftime '%b %d, %I:%M:%S%p' $goaltimeunix) + timepending=$(formattimedelta $((goaltimeunix-currenttimearray[1])) $datewidth) + if [[ $i = $goalptr ]]; then + infostring+="\n > $i. time: $goaltimestr ($timepending), goal: $goalstr " + else + infostring+="\n $i. time: $goaltimestr ($timepending), goal: $goalstr " + fi + else + if [[ $goalmaxsprint != "-" ]]; then + infostring+="\n sprint $goalsprint/$goalmaxsprint " + else + infostring+="\n sprint $goalsprint/infinity " + fi + fi + done + fi + if [[ $1 = "I" ]] || (((termheight <= (goalmaxptr+4)) && goaldone==0 )); then + clear + printf "Press 'q' to continue\n$infostring\n " | less -R 2>/dev/null + tput smcup + else + infostring+="\nPress any key to continue " + printf "$infostring" + read -t5 -k1 fi - printf "\nPress any key to continue" - read -t5 -k1 #tput -S <