Skip to content

Commit afde1db

Browse files
Merge pull request #848 from hippietrail/just-searchfor-grep-fallback
fix: fall back to `grep` when `rg` is not available
2 parents ab92b31 + 0b3f1f0 commit afde1db

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

justfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,12 @@ addnoun noun:
270270

271271
# Search Harper's curated dictionary for a specific word
272272
searchdictfor word:
273-
cargo run --bin harper-cli -- words | rg {{word}}
273+
#! /bin/bash
274+
if command -v rg > /dev/null; then
275+
cargo run --bin harper-cli -- words | rg {{word}}
276+
else
277+
cargo run --bin harper-cli -- words | grep {{word}}
278+
fi
274279

275280
# Find words in the user's `harper-ls/dictionary.txt` for words already in the curated dictionary.
276281
userdictoverlap:

0 commit comments

Comments
 (0)