aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
+