diff options
| author | not_a_robot06 <temporarythrowaway@tutamail.com> | 2025-07-06 23:07:38 +0100 |
|---|---|---|
| committer | not_a_robot06 <temporarythrowaway@tutamail.com> | 2025-07-06 23:07:38 +0100 |
| commit | be35de785e659cc080dd902cf296b5ce270e2e3f (patch) | |
| tree | d2c5f630b79aaa299d8922f7584a406d15c00672 /flashot.sh | |
| parent | b8fc75f962891aa7def3b1829d83534350dfe21d (diff) | |
| download | flashot-be35de785e659cc080dd902cf296b5ce270e2e3f.tar.gz flashot-be35de785e659cc080dd902cf296b5ce270e2e3f.tar.bz2 flashot-be35de785e659cc080dd902cf296b5ce270e2e3f.zip | |
first proper version
- use hyphens only for separation
- only two scripts: one for screenshots and one for making the cards
- add README
- a little bit of error checking
- TODO: if question or answer non existent, then don't break cards.txt
Diffstat (limited to 'flashot.sh')
| -rwxr-xr-x | flashot.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/flashot.sh b/flashot.sh new file mode 100755 index 0000000..bc56f68 --- /dev/null +++ b/flashot.sh @@ -0,0 +1,32 @@ +#!/bin/sh +mkdir -p /tmp/flashot + +photoname=$(ls /tmp/flashot | cut -d- -f1 | uniq | dmenu -i -p "name of screenshots? (no hyphens)") +case "$photoname" in + *-* ) + printf "ok" | dmenu -p "not a valid name (no hyphens!)" + exit 1 + ;; + final ) + printf "ok" | dmenu -p "not a valid name (don't call it \"final\")" + exit 1 + ;; +esac + +photonumber=$(basename -a $(ls /tmp/flashot/"$photoname"*) | cut -d- -f2 | uniq | tac | dmenu -i -p "number?") + +type=$(printf "question\nanswer" | dmenu -i -p "question or answer?") +if [ "$type" = "question" ]; then + type=q +else + type=a +fi + +partnumber=$(ls /tmp/flashot/"$photoname"-"$photonumber"-"$type"-* | tail -n1 | cut -d- -f4 | cut -d. -f1) +if [ -z "$partnumber" ]; then + partnumber=0 +else + partnumber=$(printf "%s+1\n" "$partnumber" | bc) +fi + +scrot -s /tmp/flashot/"$photoname"-"$photonumber"-"$type"-"$partnumber".png |
