From 05e1216b45340702f82a4946002015a05cebe9b1 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 18 Jun 2024 16:12:01 +0200 Subject: checkpoint --- bin/extra/clock | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 bin/extra/clock (limited to 'bin/extra/clock') diff --git a/bin/extra/clock b/bin/extra/clock new file mode 100755 index 0000000..fdffae0 --- /dev/null +++ b/bin/extra/clock @@ -0,0 +1,62 @@ +#!/bin/sh + +clocks="${XDG_DATA_HOME:-$HOME}"/clocks.csv + +if [ ! -f "$clocks" ] +then + printf 'start,end,message\n' > "$clocks" +fi + +if [ "$1" = "-c" ] +then + # empty + [ "$(wc -l < "$clocks")" -eq 1 ] && exit + + timefmt="%y%m%d-%T" + IFS="," + # skip csv header + tail -n +2 "$clocks" | + while read -r start end message + do + printf "%s - %s | %s\n" "$(date -d "@$start" +"$timefmt" )" "$(date -d "@$end" +"$timefmt")" "$message" + done + exit +fi + +if [ "$1" = "-e" ] +then + $EDITOR "$clocks" + exit +fi + +trap 'exit 0' INT # The proper way to exit + +while true +do + >&2 printf ' > ' + message="$(head -n 1)" + + [ "$message" ] || exit 1 + printf '\033[1A' # move cursor up once: https://en.wikipedia.org/wiki/ANSI_escape_code + + start_time="$(date +%s)" + start_time_pretty="$(date -d "@$start_time" +%R)" + >&2 printf -- '\r%s- > %s' "$start_time_pretty" "$message" + + # Wait for EOF + cat > /dev/null 2>&1 + + end_time="$(date +%s)" + end_time_pretty="$(date -d "@$end_time" +%R)" + >&2 printf -- '\r%s-%s > %s\n' "$start_time_pretty" "$end_time_pretty" "$message" + + if printf '%s' "$message" | grep ',' > /dev/null + then + # escape potential double quotes + message="$(printf '%s' "$message" | sed -e 's/"/""/g')" + message="\"$message\"" + fi + + # save clocked time and message + printf '%s,%s,%s\n' "$start_time" "$end_time" "$message" >> "$clocks" +done -- cgit v1.2.3 From 41d3ecdd5245c8c3f8adaa76bbdca24eacd9e007 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 20 Jun 2024 21:18:38 +0200 Subject: checkpoint --- bin/extra/clock | 4 +++- config/essentials/vis/plugins/init.lua | 2 ++ config/essentials/vis/visrc.lua | 4 +--- config/extra/mutt/.gitignore | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 config/essentials/vis/plugins/init.lua (limited to 'bin/extra/clock') diff --git a/bin/extra/clock b/bin/extra/clock index fdffae0..bd6efd2 100755 --- a/bin/extra/clock +++ b/bin/extra/clock @@ -7,7 +7,8 @@ then printf 'start,end,message\n' > "$clocks" fi -if [ "$1" = "-c" ] +# print clocks file prettily +if [ "$1" = "-p" ] then # empty [ "$(wc -l < "$clocks")" -eq 1 ] && exit @@ -23,6 +24,7 @@ then exit fi +# edit clocks file in $EDITOR if [ "$1" = "-e" ] then $EDITOR "$clocks" diff --git a/config/essentials/vis/plugins/init.lua b/config/essentials/vis/plugins/init.lua new file mode 100644 index 0000000..80c9280 --- /dev/null +++ b/config/essentials/vis/plugins/init.lua @@ -0,0 +1,2 @@ +require("plugins.vis-cursors") +require("plugins.vis-title") diff --git a/config/essentials/vis/visrc.lua b/config/essentials/vis/visrc.lua index 1813888..81e09eb 100644 --- a/config/essentials/vis/visrc.lua +++ b/config/essentials/vis/visrc.lua @@ -3,9 +3,7 @@ ------------------------------------ require('vis') -require('plugins/vis-cursors') -require('plugins/vis-title') -require('plugins/vis-snippets') +require('plugins') ------------------------------------ --- EVENTS diff --git a/config/extra/mutt/.gitignore b/config/extra/mutt/.gitignore index 5e46596..ad7bbfd 100644 --- a/config/extra/mutt/.gitignore +++ b/config/extra/mutt/.gitignore @@ -1 +1,2 @@ -cache \ No newline at end of file +cache +mailboxes -- cgit v1.2.3