aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2022-08-28 20:53:12 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2022-08-28 20:53:12 +0200
commitc977416a8911f2fce34d7f31aafbb67d2b72863c (patch)
tree6bbb7fb22d1a4a08d1e9a88d910d7b26024cdbbb
parent4482feca449a6a96339faf561929c6d5918b4bef (diff)
downloadmark-c977416a8911f2fce34d7f31aafbb67d2b72863c.tar.gz
mark-c977416a8911f2fce34d7f31aafbb67d2b72863c.zip
support extended regex in count command
-rw-r--r--functions/mark.fish10
1 files changed, 5 insertions, 5 deletions
diff --git a/functions/mark.fish b/functions/mark.fish
index ea66714..81ffbd4 100644
--- a/functions/mark.fish
+++ b/functions/mark.fish
@@ -128,13 +128,13 @@ function __mark_append_mark --argument mark date
end
end
-function __mark_count --argument mark
- if test -z "$mark"
- echo "No mark to count" >&2
+function __mark_count --argument pattern
+ if test -z "$pattern"
+ echo "No countable pattern provided" >&2
return 1
end
- grep -v '[1-9][0-9][0-9][0-9]:' (__mark_find_store) | sed -r 's/^.{3}//' | grep -o $mark | wc -l
+ grep -v '[1-9][0-9][0-9][0-9]:' (__mark_find_store) | sed -r 's/^.{3}//' | grep -Eo $pattern | wc -l
return 0
end
@@ -160,7 +160,7 @@ function __mark_print_usage
echo "Cmds:"
echo " print [before] [after]: print marks in range [date-before, date-after]"
echo " edit: open the mark store file in an editor or using xdg-open"
- echo " count <mark>: count the occurrences of <mark> in the mark store"
+ echo " count <pattern>: count the occurrences of <pattern> in the mark store"
end
function mark --argument cmd