Skip to content

Commit

Permalink
Merge pull request #12 from tmck-code/choice-category-printing
Browse files Browse the repository at this point in the history
Choice category printing
  • Loading branch information
tmck-code authored Mar 10, 2022
2 parents 059af03 + 683ed6c commit f24d829
Show file tree
Hide file tree
Showing 3 changed files with 5,088 additions and 10,621 deletions.
2 changes: 1 addition & 1 deletion build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ all: build/docker build/cows build/release
build/docker:
docker build \
-f Dockerfile \
-t pokesay-go:latest .
-t pokesay-go:latest ..

build/cows:
@rm -rf cows.tar.gz cows/
Expand Down
28 changes: 26 additions & 2 deletions build/bindata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,33 @@ type PokemonData struct {
Data []byte
}
var PokemonList []PokemonData = []PokemonData{" > tmp
var PokemonList []PokemonData = []PokemonData{" > header

grep 'var _cows' bindata.go | sed 's/var _cows/\t{PokemonName{[]string{"/g' | sed 's/Cow = /Cow"}, ""}, []byte(/g' | sed 's/$/)},/g' >> tmp
cp bindata.go bindata.go.bak

grep 'var _cows' bindata.go > pokemon_data
grep '^.*"cows/.*cow",$' bindata.go > pokemon_names

rm -f left centre right data tmp tmp_bytes tmp_end

echo "Generating data"
while read -r line; do
echo $line | cut -d '=' -f 2 >> data
echo $line | sed 's/var _cows/\t{PokemonName{[]string{"/g' | sed 's/Cow = /Cow"}, "/g' | sed 's/, "".*/, "/g' >> left
echo '"}, []byte(' >> tmp_bytes
echo ')},' >> tmp_end
done < pokemon_data

echo "Generating names"
while read line; do
echo $line | sed 's/^.*cows\///g' | sed 's/\.cow",$//g' | rev | cut -d '/' -f 1 | rev >> centre
done < pokemon_names

n_pokemon=$(wc -l pokemon_data)

cat header > tmp

paste -d '' left centre tmp_bytes data tmp_end >> tmp

echo "}" >> tmp

Expand Down
Loading

0 comments on commit f24d829

Please sign in to comment.