# -*- mode: sh; sh-shell: bash -*-
# vim: set ft=bash:
# shellcheck shell=bash
#shellcheck disable=2016

### Rules to search text in a project

# for now only ripgrep support, feel free to PR other searchers

function search_for
{
    rg --smart-case --pretty "$@" | less -SR
}

## [rg_args..] - General searching for text, pretty paging the results.
rule search_for: 'is_command_installed less' 'is_command_installed rg' -

## Searches for 'FIXME:|TODO:|PLANNED:' with some context around.
rule search_issues: -- search_for -B1 -A2 '" (FIXME|TODO|PLANNED): "'
## Searches for 'FIXME:'.
rule search_fixmes: -- search_for " FIXME: "
## Searches for 'TODO:'.
rule search_todos: -- search_for " TODO: "
## Searches 'PLANNED:'.
rule search_planned: -- search_for " PLANNED: "
