Skip to content

Commit ae1f60b

Browse files
committed
Use $MEND to get the matchings of vars config
1 parent 786231b commit ae1f60b

1 file changed

Lines changed: 2 additions & 18 deletions

File tree

  • contrib/completion/zsh

contrib/completion/zsh/_todo

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,7 @@ __todo_date(){
4444
while read line; do
4545
for key in date_format dt_separator time_format; do
4646
if [[ "$line" =~ "^\s*$key\s*=\s*" ]]; then
47-
# Note the above check's regex is different then this one. That's
48-
# because '=~' type matching and pattern replacement use different
49-
# syntaxes. We need to strip the actual value from the whole line with
50-
# multiple string replacements
51-
#
52-
# First, we remove all spaces
53-
line="${line// /}"
54-
# And now, we remove the date_format= prefix
55-
line="${line#$key=}"
47+
line="${line[$MEND+1,${#line}]}"
5648
date_time_dict[$key]="$line"
5749
fi
5850
done
@@ -101,15 +93,7 @@ __todo_lists(){
10193
# parse configuration file to get where the tasks are stored (main.path)
10294
while read line; do
10395
if [[ "$line" =~ '^\s*path\s*=\s*' ]]; then
104-
# Note the above check's regex is different then this one. That's
105-
# because '=~' type matching and pattern replacement use different
106-
# syntaxes. We need to strip the actual path from the whole line with
107-
# multiple string replacements
108-
#
109-
# First, we remove all spaces
110-
tasks_path="${line// /}"
111-
# And now, we remove the path= prefix
112-
tasks_path="${tasks_path#path=}"
96+
tasks_path="${line[$MEND+1,${#line}]}"
11397
break
11498
fi
11599
done < "$conf_file"

0 commit comments

Comments
 (0)