aboutsummaryrefslogtreecommitdiff
path: root/collector
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-07-27 17:54:52 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-07-27 17:54:52 -0300
commit4ec2ccefc35e250650f702e08b1c916d112761a8 (patch)
tree39889344c2842e1f17147cf0555ad450e15511b1 /collector
parent9e2ce95bc99977bf47c9cfbe3489440cdd3418d7 (diff)
downloadscripts-4ec2ccefc35e250650f702e08b1c916d112761a8.tar.gz
scripts-4ec2ccefc35e250650f702e08b1c916d112761a8.tar.bz2
Feat: collector: count action
Diffstat (limited to 'collector')
-rwxr-xr-xcollector9
1 files changed, 7 insertions, 2 deletions
diff --git a/collector b/collector
index 570d13c..387cb02 100755
--- a/collector
+++ b/collector
@@ -9,6 +9,7 @@
# Parameters
BASENAME="`basename $0`"
ACTION="$1"
+COLLECTOR_NAME="`echo $COLLECTOR_FILE | sed -e "s|$HOME|~|"`"
# Check
if [ -z "$COLLECTOR_FILE" ]; then
@@ -30,13 +31,17 @@ elif [ "$ACTION" == "add" ]; then
echo "* $*" >> "$COLLECTOR_FILE"
elif [ "$ACTION" == "list" ]; then
if grep -q -e "^ *\* " "$COLLECTOR_FILE"; then
- COLLECTOR_NAME="`echo $COLLECTOR_FILE | sed -e "s|$HOME|~|"`"
-
echo "Collected items at $COLLECTOR_NAME:"
echo ""
grep -e "^ *\* " "$COLLECTOR_FILE"
echo ""
fi
+elif [ "$ACTION" == "count" ]; then
+ if grep -q -e "^ *\* " "$COLLECTOR_FILE"; then
+ COUNT="`grep -e "^ *\* " "$COLLECTOR_FILE" | wc -l`"
+ echo "$COUNT collected items at $COLLECTOR_NAME"
+ echo ""
+ fi
elif [ "$ACTION" == "edit" ]; then
if [ ! -z "$EDITOR" ]; then
$EDITOR "$COLLECTOR_FILE"