summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Bobov <abobov@gmail.com>2021-04-27 19:34:35 +0500
committerAnton Bobov <abobov@gmail.com>2021-04-27 19:34:35 +0500
commitabc2d412cbd393bf715d13d913a707305c2233d8 (patch)
tree70c51e3768a0b0dd476dfffe2b1f1535b6cf771e
parent5ca89d1e147e96a2ea28a33845b18fc4648dd6ad (diff)
Watson helpers.
-rwxr-xr-xwadd30
-rwxr-xr-xwstart14
-rwxr-xr-xwstatus6
3 files changed, 50 insertions, 0 deletions
diff --git a/wadd b/wadd
new file mode 100755
index 0000000..b13b8bf
--- /dev/null
+++ b/wadd
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+set -e
+
+read -p 'Which day? ' -i 'today' -e
+DAY=$(date -d "$REPLY" +%F)
+read -p 'Which time? ' -i "$(date +%H:%M)" -e
+TIME=$(date -d "$REPLY" +%H:%M:%S)
+read -p 'How long? '
+DURATION="$REPLY"
+
+if [[ -z $DURATION ]] ; then
+ exit
+fi
+
+DATE_FORMAT="+%F %H:%M:%S"
+
+START_UNIX=$(($(date -d "$DAY $TIME" +%s) + $DURATION * 60))
+FROM=$(date -d "$DAY $TIME" "$DATE_FORMAT")
+TO=$(date -d "@$START_UNIX" "$DATE_FORMAT")
+
+read -p 'Enter project name (press Enter to select): '
+if [[ -z $REPLY ]] ; then
+ PROJECT=$(watson projects | fzf --reverse --tac --no-sort)
+else
+ PROJECT="$REPLY"
+fi
+TAGS=$(watson tags | fzf --reverse --multi | awk '{print "+" $0}' | paste -sd " " -)
+
+watson add --from "$FROM" --to "$TO" $PROJECT $TAGS
diff --git a/wstart b/wstart
new file mode 100755
index 0000000..75c2918
--- /dev/null
+++ b/wstart
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -e
+
+read -p 'Enter project name (press Enter to select): '
+if [[ -z $REPLY ]] ; then
+ PROJECT=$(watson projects | fzf --reverse --tac --no-sort)
+else
+ PROJECT="$REPLY"
+fi
+TAGS=$(watson tags | fzf --reverse --multi | awk '{print "+" $0}' | paste -sd " " -)
+
+watson stop >/dev/null 2>&1 || true
+watson start $PROJECT $TAGS
diff --git a/wstatus b/wstatus
new file mode 100755
index 0000000..0041f5c
--- /dev/null
+++ b/wstatus
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+set -e
+
+watson status
+watson report --day