lgram

A command-line utility for drilling Latin grammar.
git clone git://git.jtobin.io/lgram.git
Log | Files | Refs | README

commit 64bc43426ebf592174053345d868540db5ae81b5
parent d9184712f8e99d5683393c84ce218dbe8b7af295
Author: Jared Tobin <jared@jtobin.io>
Date:   Sat,  6 Jan 2024 04:35:00 +0400

Easier filtering on disjunctions.

Diffstat:
MREADME.md | 11+++++++++--
Mconj | 4++--
Mdecl | 3++-
3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md @@ -24,7 +24,14 @@ E.g.: ``` to drill only conjugations in *both* the active voice *and* with subjunctive -mood. +mood. You can use pipes for logical disjunction. E.g.: + +``` +./conj "coniūnctīvus|āctivum" +``` + +to drill only conjugations in *either* the active voice *or* with +subjunctive mood. To drill declensions, use: @@ -35,7 +42,7 @@ To drill declensions, use: It can be filtered on analogously, e.g.: ``` -./decl "dēclīnātiō II" nomina singulāris +./decl "dēclīnātiō I|dēclīnātiō II" nomina singulāris ``` Press 'q' to quit. diff --git a/conj b/conj @@ -435,8 +435,8 @@ IFS="|" if [[ ! -z "$@" ]]; then for arg in "$@"; do - echo $arg - DATA=$(grep -E "$arg" <<< "$DATA") + sarg=$(echo -n "$arg" | sed 's/|/\\b|\\b/g') + DATA=$(grep -E "\b$sarg\b" <<< "$DATA") done if [[ -z "$DATA" ]]; then diff --git a/decl b/decl @@ -73,7 +73,8 @@ IFS="|" if [[ ! -z "$@" ]]; then for arg in "$@"; do - DATA=$(grep -E "\b$arg\b" <<< "$DATA") + sarg=$(echo -n "$arg" | sed 's/|/\\b|\\b/g') + DATA=$(grep -E "\b$sarg\b" <<< "$DATA") done if [[ -z "$DATA" ]]; then