Skip to content

Commit 1fd0d05

Browse files
Merge pull request #273 from digitalghost-dev/1.9.4
1.9.4
2 parents 4d6237c + eb9983c commit 1fd0d05

17 files changed

Lines changed: 539 additions & 174 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ on:
3131
- main
3232

3333
env:
34-
VERSION_NUMBER: 'v1.9.3'
34+
VERSION_NUMBER: 'v1.9.4'
3535
DOCKERHUB_REGISTRY_NAME: 'digitalghostdev/poke-cli'
3636
AWS_REGION: 'us-west-2'
3737

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ builds:
1414
- windows
1515
- darwin
1616
ldflags:
17-
- -s -w -X main.version=v1.9.3
17+
- -s -w -X main.version=v1.9.4
1818

1919
archives:
2020
- formats: [ 'zip' ]

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN go mod download
88

99
COPY . .
1010

11-
RUN go build -ldflags "-X main.version=v1.9.3" -o poke-cli .
11+
RUN go build -ldflags "-X main.version=v1.9.4" -o poke-cli .
1212

1313
# build 2
1414
FROM --platform=$BUILDPLATFORM alpine:3.23

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img width="425" src="poke-cli.png" alt="pokemon-logo"/>
33
<h4></h4>
44
<img src="https://img.shields.io/github/v/release/digitalghost-dev/poke-cli?style=flat-square&logo=git&logoColor=FFCC00&label=Release%20Version&labelColor=EEE&color=FFCC00" alt="version-label">
5-
<img src="https://img.shields.io/docker/image-size/digitalghostdev/poke-cli/v1.9.3?arch=arm64&style=flat-square&logo=docker&logoColor=FFCC00&labelColor=EEE&color=FFCC00" alt="docker-image-size">
5+
<img src="https://img.shields.io/docker/image-size/digitalghostdev/poke-cli/v1.9.4?arch=arm64&style=flat-square&logo=docker&logoColor=FFCC00&labelColor=EEE&color=FFCC00" alt="docker-image-size">
66
<img src="https://img.shields.io/github/actions/workflow/status/digitalghost-dev/poke-cli/ci.yml?branch=main&style=flat-square&logo=github&logoColor=FFCC00&label=CI&labelColor=EEE&color=FFCC00" alt="ci-status-badge">
77
</div>
88
<div align="center">
@@ -99,11 +99,11 @@ Cloudsmith is a fully cloud-based service that lets you easily create, store, an
9999
3. Choose how to interact with the container:
100100
* Run a single command and exit:
101101
```bash
102-
docker run --rm -it digitalghostdev/poke-cli:v1.9.3 <command> [subcommand] [flag]
102+
docker run --rm -it digitalghostdev/poke-cli:v1.9.4 <command> [subcommand] [flag]
103103
```
104104
* Enter the container and use its shell:
105105
```bash
106-
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.9.3 -c "cd /app && exec sh"
106+
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.9.4 -c "cd /app && exec sh"
107107
# placed into the /app directory, run the program with './poke-cli'
108108
# example: ./poke-cli ability swift-swim
109109
```
@@ -112,13 +112,13 @@ Cloudsmith is a fully cloud-based service that lets you easily create, store, an
112112
> The `card` command renders TCG card images using your terminal's graphics protocol. When running inside Docker, pass your terminal's environment variables so image rendering works correctly:
113113
> ```bash
114114
> # Kitty
115-
> docker run --rm -it -e TERM -e KITTY_WINDOW_ID digitalghostdev/poke-cli:v1.9.3 card
115+
> docker run --rm -it -e TERM -e KITTY_WINDOW_ID digitalghostdev/poke-cli:v1.9.4 card
116116
>
117117
> # WezTerm, iTerm2, Ghostty, Konsole, Rio, Tabby
118-
> docker run --rm -it -e TERM -e TERM_PROGRAM digitalghostdev/poke-cli:v1.9.3 card
118+
> docker run --rm -it -e TERM -e TERM_PROGRAM digitalghostdev/poke-cli:v1.9.4 card
119119
>
120120
> # Windows Terminal (Sixel)
121-
> docker run --rm -it -e WT_SESSION digitalghostdev/poke-cli:v1.9.3 card
121+
> docker run --rm -it -e WT_SESSION digitalghostdev/poke-cli:v1.9.4 card
122122
> ```
123123
> If your terminal is not listed above, image rendering is not supported inside Docker.
124124

card_data/pipelines/defs/extract/tcgcsv/extract_pricing.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,15 @@ def pull_product_information(set_number: str) -> pl.DataFrame:
137137
print(colored(" →", "blue"), f"Processing set: {set_number}")
138138

139139
product_id = SET_PRODUCT_MATCHING[set_number]
140+
headers = {"User-Agent": "poke-cli/1.9"}
140141

141142
# Fetch product data
142143
products_url = f"https://tcgcsv.com/tcgplayer/3/{product_id}/products"
143-
products_data = requests.get(products_url, timeout=30).json()
144+
products_data = requests.get(products_url, timeout=30, headers=headers).json()
144145

145146
# Fetch pricing data
146147
prices_url = f"https://tcgcsv.com/tcgplayer/3/{product_id}/prices"
147-
prices_data = requests.get(prices_url, timeout=30).json()
148+
prices_data = requests.get(prices_url, timeout=30, headers=headers).json()
148149

149150
price_dict = {
150151
price["productId"]: price.get("marketPrice")

card_data/pipelines/poke_cli_dbt/dbt_project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'poke_cli_dbt'
2-
version: '1.9.3'
2+
version: '1.9.4'
33

44
profile: 'poke_cli_dbt'
55

cmd/item/item.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"charm.land/lipgloss/v2"
1010
"github.com/digitalghost-dev/poke-cli/cmd/utils"
1111
"github.com/digitalghost-dev/poke-cli/connections"
12+
"github.com/digitalghost-dev/poke-cli/constants"
1213
"github.com/digitalghost-dev/poke-cli/structs"
1314
"github.com/digitalghost-dev/poke-cli/styling"
1415
)
@@ -78,7 +79,7 @@ func itemInfoContainer(output *strings.Builder, itemStruct structs.ItemJSONStruc
7879
fullDoc = lipgloss.JoinVertical(lipgloss.Top, capitalizedItem, itemCost, itemCategory, "---", "Description:", missingData)
7980
} else {
8081
for _, entry := range itemStruct.FlavorTextEntries {
81-
if entry.Language.Name == "en" && entry.VersionGroup.Name == "sword-shield" {
82+
if entry.Language.Name == "en" && entry.VersionGroup.Name == constants.VersionSwordShield {
8283
if entry.Text != "" {
8384
flavorTextEntry = entry.Text
8485
fullDoc = lipgloss.JoinVertical(lipgloss.Top, capitalizedItem, itemCost, itemCategory, "---", "Description:", flavorTextEntry)

cmd/move/move.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"charm.land/lipgloss/v2"
1111
"github.com/digitalghost-dev/poke-cli/cmd/utils"
1212
"github.com/digitalghost-dev/poke-cli/connections"
13+
"github.com/digitalghost-dev/poke-cli/constants"
1314
"github.com/digitalghost-dev/poke-cli/structs"
1415
"github.com/digitalghost-dev/poke-cli/styling"
1516
"golang.org/x/text/cases"
@@ -110,12 +111,12 @@ func moveEffectContainer(output *strings.Builder, moveStruct structs.MoveJSONStr
110111
continue
111112
}
112113

113-
if entry.VersionGroup.Name == "scarlet-violet" {
114+
if entry.VersionGroup.Name == constants.VersionScarletViolet {
114115
sv = entry.FlavorText
115116
break
116117
}
117118

118-
if entry.VersionGroup.Name == "sword-shield" {
119+
if entry.VersionGroup.Name == constants.VersionSwordShield {
119120
swsh = entry.FlavorText
120121
}
121122
}

cmd/pokemon/pokemon.go

Lines changed: 6 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@ import (
66
"flag"
77
"fmt"
88
"io"
9-
"math"
109
"os"
11-
"sort"
1210
"strings"
1311

14-
"charm.land/lipgloss/v2"
1512
"github.com/digitalghost-dev/poke-cli/cmd/utils"
1613
"github.com/digitalghost-dev/poke-cli/connections"
1714
"github.com/digitalghost-dev/poke-cli/flags"
1815
"github.com/digitalghost-dev/poke-cli/styling"
19-
"golang.org/x/text/cases"
20-
"golang.org/x/text/language"
2116
)
2217

2318
// PokemonCommand processes the Pokémon command
@@ -83,150 +78,6 @@ func PokemonCommand() (string, error) {
8378

8479
capitalizedString := styling.CapitalizeResourceName(pokemonName)
8580

86-
entry := func(w io.Writer) {
87-
for _, entry := range pokemonSpeciesStruct.FlavorTextEntries {
88-
if entry.Language.Name == "en" && (entry.Version.Name == "x" || entry.Version.Name == "shield" || entry.Version.Name == "scarlet") {
89-
flavorText := strings.ReplaceAll(entry.FlavorText, "\n", " ")
90-
flavorText = strings.Join(strings.Fields(flavorText), " ")
91-
92-
wrapped := utils.WrapText(flavorText, 60)
93-
fmt.Fprintln(w, wrapped)
94-
return
95-
}
96-
}
97-
}
98-
99-
eggInformation := func(w io.Writer) {
100-
var eggInformationSlice []string
101-
102-
modernEggInformationNames := map[string]string{
103-
"indeterminate": "Amorphous",
104-
"ground": "Field",
105-
"humanshape": "Human-Like",
106-
"plant": "Grass",
107-
"no-eggs": "Undiscovered",
108-
}
109-
110-
for _, entry := range pokemonSpeciesStruct.EggGroups {
111-
if name, exists := modernEggInformationNames[entry.Name]; exists {
112-
eggInformationSlice = append(eggInformationSlice, name)
113-
} else {
114-
eggInformationSlice = append(eggInformationSlice, cases.Title(language.English).String(entry.Name))
115-
}
116-
}
117-
118-
sort.Strings(eggInformationSlice)
119-
120-
genderRate := pokemonSpeciesStruct.GenderRate
121-
m := map[int]string{
122-
-1: "Genderless",
123-
0: "0% F",
124-
1: "12.5% F",
125-
2: "25% F",
126-
3: "37.5% F",
127-
4: "50% F",
128-
5: "62.5% F",
129-
6: "75% F",
130-
7: "87.5% F",
131-
8: "100% F",
132-
}
133-
134-
hatchCounter := pokemonSpeciesStruct.HatchCounter
135-
136-
fmt.Fprintf(w,
137-
"\n%s %s %s\n%s %s %s\n%s %s %d",
138-
styling.ColoredBullet,
139-
"Egg Group(s):", strings.Join(eggInformationSlice, ", "),
140-
styling.ColoredBullet,
141-
"Gender Rate:", m[genderRate],
142-
styling.ColoredBullet,
143-
"Egg Cycles:", hatchCounter,
144-
)
145-
}
146-
147-
effortValues := func(w io.Writer) {
148-
nameMapping := map[string]string{
149-
"hp": "HP",
150-
"attack": "Atk",
151-
"defense": "Def",
152-
"special-attack": "SpA",
153-
"special-defense": "SpD",
154-
"speed": "Spd",
155-
}
156-
157-
var evs []string
158-
159-
for _, effortValue := range pokemonStruct.Stats {
160-
if effortValue.Effort > 0 {
161-
name, ok := nameMapping[effortValue.Stat.Name]
162-
if !ok {
163-
name = "Missing from API"
164-
}
165-
evs = append(evs, fmt.Sprintf("%d %s", effortValue.Effort, name))
166-
}
167-
}
168-
169-
fmt.Fprintf(w, "\n%s Effort Values: %s", styling.ColoredBullet, strings.Join(evs, ", "))
170-
}
171-
172-
typing := func(w io.Writer) {
173-
var typeBoxes []string
174-
175-
for _, pokeType := range pokemonStruct.Types {
176-
colorHex, exists := styling.ColorMap[pokeType.Type.Name]
177-
if exists {
178-
color := lipgloss.Color(colorHex)
179-
typeColorStyle := lipgloss.NewStyle().
180-
Align(lipgloss.Center).
181-
Foreground(lipgloss.Color("#FAFAFA")).
182-
Background(color).
183-
Margin(1, 1, 0, 0).
184-
Height(1).
185-
Width(14)
186-
187-
rendered := typeColorStyle.Render(cases.Title(language.English).String(pokeType.Type.Name))
188-
typeBoxes = append(typeBoxes, rendered)
189-
}
190-
}
191-
192-
joinedTypes := lipgloss.JoinHorizontal(lipgloss.Top, typeBoxes...)
193-
fmt.Fprintln(w, joinedTypes)
194-
}
195-
196-
metrics := func(w io.Writer) {
197-
// Weight calculation
198-
weightKilograms := float64(pokemonStruct.Weight) / 10
199-
weightPounds := float64(weightKilograms) * 2.20462
200-
201-
// Height calculation
202-
heightMeters := float64(pokemonStruct.Height) / 10
203-
heightFeet := heightMeters * 3.28084
204-
feet := int(heightFeet)
205-
inches := int(math.Round((heightFeet - float64(feet)) * 12)) // Use math.Round to avoid truncation
206-
207-
// Adjust for rounding to 12 inches (carry over to the next foot)
208-
if inches == 12 {
209-
feet++
210-
inches = 0
211-
}
212-
213-
fmt.Fprintf(w, "\n%s National Pokédex #: %d\n%s Weight: %.1fkg (%.1f lbs)\n%s Height: %.1fm (%d′%02d″)\n",
214-
styling.ColoredBullet, pokemonStruct.ID,
215-
styling.ColoredBullet, weightKilograms, weightPounds,
216-
styling.ColoredBullet, heightMeters, feet, inches)
217-
}
218-
219-
species := func(w io.Writer) {
220-
if pokemonSpeciesStruct.EvolvesFromSpecies.Name != "" {
221-
evolvesFrom := pokemonSpeciesStruct.EvolvesFromSpecies.Name
222-
223-
capitalizedPokemonName := styling.CapitalizeResourceName(evolvesFrom)
224-
fmt.Fprintf(w, "%s %s %s", styling.ColoredBullet, "Evolves from:", capitalizedPokemonName)
225-
} else {
226-
fmt.Fprintf(w, "%s %s", styling.ColoredBullet, "Basic Pokémon")
227-
}
228-
}
229-
23081
var (
23182
entryOutput bytes.Buffer
23283
eggGroupOutput bytes.Buffer
@@ -236,12 +87,12 @@ func PokemonCommand() (string, error) {
23687
effortValuesOutput bytes.Buffer
23788
)
23889

239-
entry(&entryOutput)
240-
eggInformation(&eggGroupOutput)
241-
typing(&typeOutput)
242-
metrics(&metricsOutput)
243-
species(&speciesOutput)
244-
effortValues(&effortValuesOutput)
90+
renderEntry(&entryOutput, pokemonSpeciesStruct)
91+
renderEggInformation(&eggGroupOutput, pokemonSpeciesStruct)
92+
renderTyping(&typeOutput, pokemonStruct)
93+
renderMetrics(&metricsOutput, pokemonStruct)
94+
renderSpecies(&speciesOutput, pokemonSpeciesStruct)
95+
renderEffortValues(&effortValuesOutput, pokemonStruct)
24596

24697
fmt.Fprintf(&output,
24798
"Your selected Pokémon: %s\n%s\n%s%s%s%s%s\n",

0 commit comments

Comments
 (0)