aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2022-08-21 02:13:15 +0000
committerJulio Capote <jcapote@gmail.com>2022-08-21 02:13:15 +0000
commit9e4f34a5989f6be48eaaebf17c8e42e61ebf3d76 (patch)
treea8344ead91c834ae5969ef68bbbc528419da9a78 /libexec
parentbfec59e271a9c95f6ab755cc6d6795b4012bb62b (diff)
downloadrecit-9e4f34a5989f6be48eaaebf17c8e42e61ebf3d76.tar.gz
add entries command
Diffstat (limited to '')
-rwxr-xr-xlibexec/recit-entries37
1 files changed, 37 insertions, 0 deletions
diff --git a/libexec/recit-entries b/libexec/recit-entries
new file mode 100755
index 0000000..343006d
--- /dev/null
+++ b/libexec/recit-entries
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+# Usage: recit entries [-p project-name]
+
+# shellcheck source=/dev/null
+source lib/loader
+
+recfile=$(load_recit)
+
+project=""
+
+while getopts "p:" options; do
+
+ case "${options}" in
+ p)
+ project=${OPTARG}
+ ;;
+ :)
+ echo "Error: -${OPTARG} requires an argument."
+ exit 1
+ ;;
+ *)
+ exit 1
+ ;;
+ esac
+done
+
+if [[ "$project" = "" ]]; then
+ recsel -t Entry "${recfile}"
+else
+ if recsel -t Project -p Id ${recfile} | grep "$project" > /dev/null; then
+ recsel -e "ProjectRef = '$project'" -t Entry "${recfile}"
+ else
+ echo "$project not found, list of available projects:"
+ recsel -t Project -p Id ${recfile}
+ fi
+fi
+