commit f37988a77b19d9d6dc194b3392101723c50bb097 parent 2ed5c3a7a0d6855172ea7cc694ad656d0701f9e2 Author: Jared Tobin <jared@jtobin.io> Date: Thu, 11 Feb 2021 15:09:22 +0400 Allow filtering by keywords. Diffstat:
M | README.md | | | 9 | +++++++++ |
M | conj | | | 12 | ++++++++++++ |
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md @@ -15,5 +15,14 @@ cd lgram ./conj ``` +You can supply keywords to filter the set of conjugations to drill. Just +append them as arguments, e.g.: + +``` +./conj coniūnctīvus āctivum +``` + +to drill only conjugations in either the active voice or with subjunctive mood. + Press 'q' to quit. diff --git a/conj b/conj @@ -311,6 +311,18 @@ prompt() { fi } +IFS="|" +args="$*" + +if [[ ! -z "$args" ]]; then + DATA=$(grep -E "$args" <<< "$DATA") + + if [[ -z "$DATA" ]]; then + echo "no results" + exit 1 + fi +fi + LOOP=true while $LOOP; do