diff options
-rwxr-xr-x | libexec/recit-add-entry | 4 | ||||
-rwxr-xr-x | libexec/recit-entries | 16 |
2 files changed, 16 insertions, 4 deletions
diff --git a/libexec/recit-add-entry b/libexec/recit-add-entry index 078000e..322472f 100755 --- a/libexec/recit-add-entry +++ b/libexec/recit-add-entry @@ -61,11 +61,11 @@ fi if [[ "$project" = "" ]]; then - recins --verbose -f Id -v "$uuid" -f Time -v "$fmt_date" -f Notes -v "$notes" -t Entry "${recfile}" + recins --verbose -f Id -v "$uuid" -f Time -v "$fmt_date" -f Notes -v "$notes" -f Context -v "$PWD" -t Entry "${recfile}" echo "$uuid" else if recsel -t Project -p Id ${recfile} | grep "$project" > /dev/null; then - recins --verbose -f Id -v "$uuid" -f Time -v "$fmt_date" -f Notes -v "$notes" -f ProjectRef -v "$project" -t Entry "${recfile}" + recins --verbose -f Id -v "$uuid" -f Time -v "$fmt_date" -f Notes -v "$notes" -f Context -v "$PWD" -f ProjectRef -v "$project" -t Entry "${recfile}" echo "$uuid" else echo "$project not found, list of available projects:" diff --git a/libexec/recit-entries b/libexec/recit-entries index ed0a0e3..4181366 100755 --- a/libexec/recit-entries +++ b/libexec/recit-entries @@ -1,19 +1,23 @@ #!/usr/bin/env bash -# Usage: recit entries [-p project-name] [-t time|today|yesterday|tomorrow] +# Usage: recit entries [-p project-name] [-t time|today|yesterday|tomorrow] [-c context] # Summary: Display entries, optionally for a Project and/or a certain time set -e project="" query_time="" +context="" recfile=$(recit-file) -while getopts "p:t:" options; do +while getopts "p:t:c:" options; do case "${options}" in p) project=${OPTARG} ;; + c) + context=${OPTARG} + ;; t) query_time=${OPTARG} ;; @@ -41,6 +45,14 @@ if ! [[ "$query_time" = "" ]]; then expression="((Time >> '$fmt_date 00:00:00' && Time << '$fmt_date 23:59:59') || Time == '$fmt_date')" fi +if ! [[ "$context" = "" ]]; then + if [[ "$expression" = "" ]]; then + expression="Context = '$context'" + else + expression+=" && Context = '$context'" + fi +fi + if ! [[ "$project" = "" ]]; then if recsel -t Project -p Id ${recfile} | grep "$project" > /dev/null; then if [[ "$expression" = "" ]]; then |