diff options
| author | Anton Bobov <abobov@gmail.com> | 2021-04-27 19:34:35 +0500 |
|---|---|---|
| committer | Anton Bobov <abobov@gmail.com> | 2021-04-27 19:34:35 +0500 |
| commit | abc2d412cbd393bf715d13d913a707305c2233d8 (patch) | |
| tree | 70c51e3768a0b0dd476dfffe2b1f1535b6cf771e | |
| parent | 5ca89d1e147e96a2ea28a33845b18fc4648dd6ad (diff) | |
Watson helpers.
| -rwxr-xr-x | wadd | 30 | ||||
| -rwxr-xr-x | wstart | 14 | ||||
| -rwxr-xr-x | wstatus | 6 |
3 files changed, 50 insertions, 0 deletions
@@ -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 @@ -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 @@ -0,0 +1,6 @@ +#!/bin/bash + +set -e + +watson status +watson report --day |
