tt/scripts/pack
Aetnaeus 955d28a8bd v0.3.0
- Added support for custom word lists (`-words).
 - `-theme` now accepts a path.
 - Added `~/.tt/themes` and `~/.tt/words`.
 - Scrapped ~/.ttrc in favour of aliases/flags.
 - Included more default word lists. (`-list words`)
2021-01-04 02:08:31 -05:00

31 lines
498 B
Bash
Executable File

#!/bin/sh
[ $# -gt 0 ] || { echo "Usage: $0 <path>... > packed.go"; exit 1; }
cat <<!
package main
import "encoding/base64"
func readPackedFile(path string) []byte {
if b,ok := packedFiles[path]; !ok {
return nil
} else {
b, err := base64.StdEncoding.DecodeString(b)
if err != nil {
panic(err)
}
return b
}
}
!
printf "var packedFiles = map[string]string{\n"
find "$@" -type f|while read f; do
printf "\t\"$f\": \""
openssl base64 -A < "$f"
printf "\",\n"
done
printf "}"