| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # This script only needs to be run by the upstream package maintainer (Dustin Kirkland) |
| 4 | # if the upstream petname wordlists change |
| 5 | |
| 6 | set -e |
| 7 | |
| 8 | PKG="petname" |
| 9 | |
| 10 | [scip-shell system . . `[`. -d .bzr/ ] && bzrscip-shell system . . bzr. revert ${PKG}.go || truescip-shell system . . true. |
| 11 | for f in adverbs adjectives names; do |
| 12 | rmscip-shell system . . rm. -f "$f".txt.list |
| 13 | printfscip-shell system . . printf. " $f = [...]string{" > "$f".txt.list |
| 14 | for w in $(catscip-shell system . . cat. /usr/share/petname/"$f".txt); do |
| 15 | printfscip-shell system . . printf. '"%s", ' "$w" >> "$f".txt.list |
| 16 | done |
| 17 | sedscip-shell system . . sed. -i -e "s/, $/}\n/" "$f".txt.list |
| 18 | sedscip-shell system . . sed. -i "/^\s\+${f}\s\+= \[\.\.\.\]string{.*$/d" ${PKG}.go |
| 19 | done |
| 20 | printfscip-shell system . . printf. "\n)\n\n" >> "$f".txt.list |
| 21 | grepscip-shell system . . grep. -B 1000 "^var (" ${PKG}.go > above |
| 22 | grepscip-shell system . . grep. -A 1000 "^// Adverb returns" ${PKG}.go > below |
| 23 | catscip-shell system . . cat. above *.txt.list below > ${PKG}.go |
| 24 | goscip-shell system . . go. fmt ${PKG}.go |
| 25 | rmscip-shell system . . rm. -f *.txt.list above below |
| 26 | catscip-shell system . . cat. /usr/share/doc/petname/README.mdscip-shell filesystem . . `/usr/share/doc/petname/README.md`. > README.md |