aboutsummaryrefslogtreecommitdiff
path: root/libexec/recit-entries
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2023-01-29 03:35:59 +0000
committerJulio Capote <jcapote@gmail.com>2023-01-29 03:35:59 +0000
commitdf9ffaaadf7f7e876706d4fd762f47d158c01d8c (patch)
treeaa89e06b1b7aacae82d275bf2b23c4b28e4f9bae /libexec/recit-entries
parent34067af321b78094f740ec2d5c8086f7d80d7615 (diff)
downloadrecit-df9ffaaadf7f7e876706d4fd762f47d158c01d8c.tar.gz
record the current directory and expose entries via `recit here`
Diffstat (limited to '')
-rwxr-xr-xlibexec/recit-entries16
1 files changed, 14 insertions, 2 deletions
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