aboutsummaryrefslogtreecommitdiffstats
path: root/grepnote_openbsd
blob: 36cb8c6e54b367cc8bf5ab21986e3e7070f698fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/local/bin/bash

NOTES=/home/$USER/Notes
RG_BIN=/usr/local/bin/rg
GREP=/usr/bin/grep
CMD="$RG_BIN --heading -w -i -g !"*fish-history*" -g !"*.html*" -g !"*apt-packages*" -g !"*.json" -g !"*-fish-history*" -g !"*backup*""

if [[ -z $1 ]]; then
    echo "You must provide a search term as the argument to this command."
    exit 1
else
    TARGET="$1"
fi

# test for rg
if ! [[ -x $RG_BIN ]]; then
    CMD="$($GREP -n -H -r)"
fi

# rg --heading -i "joanna" ~/Notes/journal/
$CMD "$TARGET" $NOTES