omoidasu

a flashcard review system built on oboeru
git clone anongit@rnpnr.xyz:omoidasu.git
Log | Files | Refs | Feed | README | LICENSE

nextcardid (246B)


      1 #!/bin/sh
      2 
      3 . ./config
      4 
      5 # finds and outputs the next missing id in deck ledger
      6 [ ! -f "$1" ] && echo 0 && exit 0
      7 
      8 sort "$1" \
      9 | awk -F $DELIM '{
     10 	w = length($1);
     11 	for (i = p + 1; i < $1; i++) {
     12 		exit
     13 	}
     14 } {p = $1} END {printf "%0"w"i\n", p + 1}'