app

package
v0.0.0-...-e50104a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAnswer

func CheckAnswer(m *Model)

func CreateDir

func CreateDir(cacheDir string)

func CreateJsonCacheFile

func CreateJsonCacheFile(jsonFile string) *os.File

func EndingScreen

func EndingScreen(m Model) string

func MakeOptions

func MakeOptions() (Country, []Country)

Get one random country and 3 other countries, isolated one will be the prompetd flag

func PopulateOptions

func PopulateOptions(m *Model)

func PopulateRandomOptions

func PopulateRandomOptions(m *Model)

func Render

func Render(m Model, style lipgloss.Style) string

func RenderAscii

func RenderAscii(imagePath string) string

func RenderFlag

func RenderFlag(m Model, style lipgloss.Style) string

func SaveImage

func SaveImage(country Country)

func ShuffleOptions

func ShuffleOptions(m *Model)

func StartingScreen

func StartingScreen() string

func TrimSpace

func TrimSpace(s string) string

func WriteJsonToCacheFile

func WriteJsonToCacheFile()

Types

type Country

type Country struct {
	Name    Name     `json:"name"`
	Flags   Flags    `json:"flags"`
	Capital []string `json:"capital"`
}

func GetAllCountries

func GetAllCountries() []Country

func GetRandomCountriesN

func GetRandomCountriesN(countries []Country, n int) []Country

Get N amount of random countries

func ReadCountries

func ReadCountries() []Country

type Flags

type Flags struct {
	Alt string `json:"alt"`
	Png string `json:"png"`
}

type Model

type Model struct {
	// contains filtered or unexported fields
}

func InitialModel

func InitialModel() Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(message tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type Name

type Name struct {
	Common string `json:"common"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳