From 29147eaef34a85e8a67e13fcc1c3642b63f820d1 Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Tue, 19 Apr 2022 19:17:08 +0500 Subject: [PATCH] todolist: add ugrep --- scripts/todolist | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/todolist b/scripts/todolist index 16bc0e2..3637435 100755 --- a/scripts/todolist +++ b/scripts/todolist @@ -4,14 +4,16 @@ [ -n "$1" ] && cd "$1" -if ! command -v rg &>/dev/null; then - GREP_CMD="grep -R -n" -else +if command -v ugrep &>/dev/null; then + GREP_CMD="ugrep -R -n" +elif command -v rg &>/dev/null; then GREP_CMD="rg" +else + GREP_CMD="grep -R -n" fi if git rev-parse --show-toplevel &>/dev/null; then - $GREP_CMD "^[[:space:]]*[#/\";-]*[[:space:]]*TODO:" . \ + $GREP_CMD "^[[:space:]]*[#/\";-]*[[:space:]]*TODO:" . 2>&- \ | expand \ | sed -E 's/([[:digit:]]):/\1:@@ /' \ | tr -s ' ' \