|
7 | 7 | "io" |
8 | 8 | "math" |
9 | 9 | "os" |
| 10 | + "sort" |
10 | 11 | "strings" |
11 | 12 |
|
12 | 13 | "github.com/charmbracelet/lipgloss" |
@@ -97,6 +98,18 @@ func PokemonCommand() (string, error) { |
97 | 98 | } |
98 | 99 | } |
99 | 100 |
|
| 101 | + eggGroup := func(w io.Writer) { |
| 102 | + var eggGroupSlice []string |
| 103 | + |
| 104 | + for _, entry := range pokemonSpeciesStruct.EggGroups { |
| 105 | + capitalizedEggGroup := cases.Title(language.English).String(entry.Name) |
| 106 | + eggGroupSlice = append(eggGroupSlice, capitalizedEggGroup) |
| 107 | + } |
| 108 | + |
| 109 | + sort.Strings(eggGroupSlice) |
| 110 | + fmt.Fprintf(w, "\n%s %s %s", styling.ColoredBullet, "Egg Group(s):", strings.Join(eggGroupSlice, ", ")) |
| 111 | + } |
| 112 | + |
100 | 113 | typing := func(w io.Writer) { |
101 | 114 | var typeBoxes []string |
102 | 115 |
|
@@ -156,20 +169,22 @@ func PokemonCommand() (string, error) { |
156 | 169 | } |
157 | 170 |
|
158 | 171 | var ( |
159 | | - entryOutput bytes.Buffer |
160 | | - typeOutput bytes.Buffer |
161 | | - metricsOutput bytes.Buffer |
162 | | - speciesOutput bytes.Buffer |
| 172 | + entryOutput bytes.Buffer |
| 173 | + eggGroupOutput bytes.Buffer |
| 174 | + typeOutput bytes.Buffer |
| 175 | + metricsOutput bytes.Buffer |
| 176 | + speciesOutput bytes.Buffer |
163 | 177 | ) |
164 | 178 |
|
165 | 179 | entry(&entryOutput) |
| 180 | + eggGroup(&eggGroupOutput) |
166 | 181 | typing(&typeOutput) |
167 | 182 | metrics(&metricsOutput) |
168 | 183 | species(&speciesOutput) |
169 | 184 |
|
170 | 185 | output.WriteString(fmt.Sprintf( |
171 | | - "Your selected Pokémon: %s\n%s%s%s%s\n", |
172 | | - capitalizedString, entryOutput.String(), typeOutput.String(), metricsOutput.String(), speciesOutput.String(), |
| 186 | + "Your selected Pokémon: %s\n%s\n%s%s%s%s\n", |
| 187 | + capitalizedString, entryOutput.String(), typeOutput.String(), metricsOutput.String(), speciesOutput.String(), eggGroupOutput.String(), |
173 | 188 | )) |
174 | 189 |
|
175 | 190 | if *imageFlag != "" || *shortImageFlag != "" { |
|
0 commit comments