Documentation ¶
Index ¶
- Variables
- func ChooseByCategory(category string, categoryDir []fs.DirEntry, categoryFiles embed.FS, ...) (pokedex.PokemonMetadata, pokedex.PokemonEntryMapping)
- func ChooseByName(names map[string][]int, nameToken string, metadataFiles embed.FS, ...) (pokedex.PokemonMetadata, pokedex.PokemonEntryMapping)
- func ChooseByNameAndCategory(names map[string][]int, nameToken string, metadataFiles embed.FS, ...) (pokedex.PokemonMetadata, pokedex.PokemonEntryMapping)
- func ChooseByRandomIndex(totalInBytes []byte) (int, int)
- func ListNames(names map[string][]int) []string
- func Print(args Args, choice int, names []string, categories []string, cows embed.FS)
- func RandomInt(n int) int
- type Args
- type BoxCharacters
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ChooseByCategory ¶ added in v0.11.0
func ChooseByCategory(category string, categoryDir []fs.DirEntry, categoryFiles embed.FS, categoryRootDir string, metadataFiles embed.FS, metadataRootDir string) (pokedex.PokemonMetadata, pokedex.PokemonEntryMapping)
ChooseByCategory chooses a pokemon via a requested category 1. It loads the category search structure and finds the name of a random Pokemon matching the entry e.g. if given the category "small", this function might pick the file `1.cat` in - categories/
- small/
- 1.cat
- 44.cat
This file contains entries representing the <pokemon metadata index>/<the pokemon entry index>, e.g. "4/1" would represent 4.metadata, and the 2nd entry in that file 2. Using the indexes, load the corresponding metadata file and entry, and then return it
func ChooseByName ¶ added in v0.11.0
func ChooseByName(names map[string][]int, nameToken string, metadataFiles embed.FS, metadataRootDir string) (pokedex.PokemonMetadata, pokedex.PokemonEntryMapping)
func ChooseByNameAndCategory ¶ added in v0.12.2
func ChooseByRandomIndex ¶ added in v0.11.0
func Print ¶ added in v0.11.0
The main print function! This uses a chosen pokemon's index, names and categories, and an embedded filesystem of cowfile data 1. The text received from STDIN is printed inside a speech bubble 2. The cowfile data is retrieved using the matching index, decompressed (un-gzipped), 3. The pokemon is printed along with the name & category information
Types ¶
type BoxCharacters ¶ added in v0.12.0
type BoxCharacters struct { HorizontalEdge string VerticalEdge string TopRightCorner string TopLeftCorner string BottomRightCorner string BottomLeftCorner string BalloonString string Separator string RightArrow string CategorySeparator string }
var ( AsciiBoxCharacters *BoxCharacters = &BoxCharacters{ HorizontalEdge: "-", VerticalEdge: "|", TopRightCorner: "\\", TopLeftCorner: "/", BottomRightCorner: "/", BottomLeftCorner: "\\", BalloonString: "\\", Separator: "|", RightArrow: ">", CategorySeparator: "/", } UnicodeBoxCharacters *BoxCharacters = &BoxCharacters{ HorizontalEdge: "─", VerticalEdge: "│", TopRightCorner: "╮", TopLeftCorner: "╭", BottomRightCorner: "╯", BottomLeftCorner: "╰", BalloonString: "╲", Separator: "│", RightArrow: "→", CategorySeparator: "/", } SingleWidthCars map[string]bool = map[string]bool{ "♀": true, "♂": true, } )
func DetermineBoxCharacters ¶ added in v0.12.0
func DetermineBoxCharacters(unicodeBox bool) *BoxCharacters