#!/bin/sh
#
# vtodo - scan codebase for todo comments and display them sorted by date
# for use in vim: qf
#
# comments are expected to be in following format:
#   // TODO(2020-12-15): Fix rendering bug

rg --follow --vimgrep --only-matching '\b(TODO|todo|FIXME)\s*\(([\d-]*?)\)[:;.,]? *(.*)' \
  --replace ' $2 | $3' -- "$@" \
  | sort --field-separator ":" --key 4 --reverse
