feat: bake in qcode json file
Signed-off-by: Christina Sørensen <ces@fem.gg>
This commit is contained in:
parent
e74c9d8661
commit
6f4a1213d2
3 changed files with 5 additions and 5 deletions
|
@ -5,14 +5,14 @@ UPCURSOR_CLEAR_ANSI="\033[1A\033[K"
|
|||
|
||||
select_random_drill() {
|
||||
local drill
|
||||
drill=$(jq 'keys[]' q-codes.json \
|
||||
drill=$(jq 'keys[]' "$1" \
|
||||
| sort -R \
|
||||
| head -n 1 \
|
||||
| xargs -I "%" jq "\
|
||||
\"%\" as \$qcode \
|
||||
| .[\$qcode] as \$qobj \
|
||||
| {qcode: \$qcode, question: \$qobj.question, answer: \$qobj.answer}" \
|
||||
q-codes.json
|
||||
"$1"
|
||||
)
|
||||
echo "$drill"
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ run_drill() {
|
|||
|
||||
main() {
|
||||
local random_drill
|
||||
random_drill="$(select_random_drill)"
|
||||
random_drill="$(select_random_drill "$@")"
|
||||
run_drill "$random_drill"
|
||||
}
|
||||
|
||||
|
@ -44,5 +44,5 @@ echo -e "To exit drills, use \e[33mctrl-c\e[0m."
|
|||
echo ""
|
||||
|
||||
while true; do
|
||||
main
|
||||
main "$@"
|
||||
done;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
jq
|
||||
figlet
|
||||
];
|
||||
text = ./bin/qcode.bash;
|
||||
text = "${./bin/qcode.bash} ${./bin/qcodes.json}";
|
||||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = [ self'.packages.default ];
|
||||
|
|
Loading…
Add table
Reference in a new issue