Skip to content
Merged

1.9.2 #263

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ on:
- main

env:
VERSION_NUMBER: 'v1.9.1'
VERSION_NUMBER: 'v1.9.2'
DOCKERHUB_REGISTRY_NAME: 'digitalghostdev/poke-cli'
AWS_REGION: 'us-west-2'

Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/python_testing.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Python Tests

on:
push:
branches:
- main
paths:
- 'card_data/**'
- 'web/**'
pull_request:
types: [opened, reopened, synchronize]
paths:
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ builds:
- windows
- darwin
ldflags:
- -s -w -X main.version=v1.9.1
- -s -w -X main.version=v1.9.2

archives:
- formats: [ 'zip' ]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN go mod download

COPY . .

RUN go build -ldflags "-X main.version=v1.9.1" -o poke-cli .
RUN go build -ldflags "-X main.version=v1.9.2" -o poke-cli .

# build 2
FROM --platform=$BUILDPLATFORM alpine:3.23
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img width="425" src="poke-cli.png" alt="pokemon-logo"/>
<h4></h4>
<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">
<img src="https://img.shields.io/docker/image-size/digitalghostdev/poke-cli/v1.9.1?arch=arm64&style=flat-square&logo=docker&logoColor=FFCC00&labelColor=EEE&color=FFCC00" alt="docker-image-size">
<img src="https://img.shields.io/docker/image-size/digitalghostdev/poke-cli/v1.9.2?arch=arm64&style=flat-square&logo=docker&logoColor=FFCC00&labelColor=EEE&color=FFCC00" alt="docker-image-size">
<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">
</div>
<div align="center">
Expand Down Expand Up @@ -99,11 +99,11 @@ Cloudsmith is a fully cloud-based service that lets you easily create, store, an
3. Choose how to interact with the container:
* Run a single command and exit:
```bash
docker run --rm -it digitalghostdev/poke-cli:v1.9.1 <command> [subcommand] [flag]
docker run --rm -it digitalghostdev/poke-cli:v1.9.2 <command> [subcommand] [flag]
```
* Enter the container and use its shell:
```bash
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.9.1 -c "cd /app && exec sh"
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.9.2 -c "cd /app && exec sh"
# placed into the /app directory, run the program with './poke-cli'
# example: ./poke-cli ability swift-swim
```
Expand All @@ -112,13 +112,13 @@ Cloudsmith is a fully cloud-based service that lets you easily create, store, an
> 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:
> ```bash
> # Kitty
> docker run --rm -it -e TERM -e KITTY_WINDOW_ID digitalghostdev/poke-cli:v1.9.1 card
> docker run --rm -it -e TERM -e KITTY_WINDOW_ID digitalghostdev/poke-cli:v1.9.2 card
>
> # WezTerm, iTerm2, Ghostty, Konsole, Rio, Tabby
> docker run --rm -it -e TERM -e TERM_PROGRAM digitalghostdev/poke-cli:v1.9.1 card
> docker run --rm -it -e TERM -e TERM_PROGRAM digitalghostdev/poke-cli:v1.9.2 card
>
> # Windows Terminal (Sixel)
> docker run --rm -it -e WT_SESSION digitalghostdev/poke-cli:v1.9.1 card
> docker run --rm -it -e WT_SESSION digitalghostdev/poke-cli:v1.9.2 card
> ```
> If your terminal is not listed above, image rendering is not supported inside Docker.

Expand Down
2 changes: 1 addition & 1 deletion card_data/pipelines/poke_cli_dbt/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'poke_cli_dbt'
version: '1.9.0'
version: '1.9.2'

profile: 'poke_cli_dbt'

Expand Down
97 changes: 74 additions & 23 deletions cmd/pokemon/pokemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,77 @@ func PokemonCommand() (string, error) {
}
}

eggGroup := func(w io.Writer) {
var eggGroupSlice []string
eggInformation := func(w io.Writer) {
var eggInformationSlice []string

modernEggInformationNames := map[string]string{
"indeterminate": "Amorphous",
"ground": "Field",
"humanshape": "Human-Like",
"plant": "Grass",
"no-eggs": "Undiscovered",
}

for _, entry := range pokemonSpeciesStruct.EggGroups {
modernEggGroupNames := map[string]string{
"indeterminate": "Amorphous",
"ground": "Field",
"humanshape": "Human-Like",
"plant": "Grass",
"no-eggs": "Undiscovered",
if name, exists := modernEggInformationNames[entry.Name]; exists {
eggInformationSlice = append(eggInformationSlice, name)
} else {
eggInformationSlice = append(eggInformationSlice, cases.Title(language.English).String(entry.Name))
}
}

if name, exists := modernEggGroupNames[entry.Name]; exists {
eggGroupSlice = append(eggGroupSlice, name)
} else {
capitalizedEggGroup := cases.Title(language.English).String(entry.Name)
eggGroupSlice = append(eggGroupSlice, capitalizedEggGroup)
sort.Strings(eggInformationSlice)

genderRate := pokemonSpeciesStruct.GenderRate
m := map[int]string{
-1: "Genderless",
0: "0% F",
1: "12.5% F",
2: "25% F",
3: "37.5% F",
4: "50% F",
5: "62.5% F",
6: "75% F",
7: "87.5% F",
8: "100% F",
}

hatchCounter := pokemonSpeciesStruct.HatchCounter

fmt.Fprintf(w,
"\n%s %s %s\n%s %s %s\n%s %s %d",
styling.ColoredBullet,
"Egg Group(s):", strings.Join(eggInformationSlice, ", "),
styling.ColoredBullet,
"Gender Rate:", m[genderRate],
styling.ColoredBullet,
"Egg Cycles:", hatchCounter,
)
}

effortValues := func(w io.Writer) {
nameMapping := map[string]string{
"hp": "HP",
"attack": "Atk",
"defense": "Def",
"special-attack": "SpA",
"special-defense": "SpD",
"speed": "Spd",
}

var evs []string

for _, effortValue := range pokemonStruct.Stats {
if effortValue.Effort > 0 {
name, ok := nameMapping[effortValue.Stat.Name]
if !ok {
name = "Missing from API"
}
evs = append(evs, fmt.Sprintf("%d %s", effortValue.Effort, name))
}
}

sort.Strings(eggGroupSlice)
fmt.Fprintf(w, "\n%s %s %s", styling.ColoredBullet, "Egg Group(s):", strings.Join(eggGroupSlice, ", "))
fmt.Fprintf(w, "\n%s Effort Values: %s", styling.ColoredBullet, strings.Join(evs, ", "))
}
Comment thread
digitalghost-dev marked this conversation as resolved.

typing := func(w io.Writer) {
Expand Down Expand Up @@ -176,22 +225,24 @@ func PokemonCommand() (string, error) {
}

var (
entryOutput bytes.Buffer
eggGroupOutput bytes.Buffer
typeOutput bytes.Buffer
metricsOutput bytes.Buffer
speciesOutput bytes.Buffer
entryOutput bytes.Buffer
eggGroupOutput bytes.Buffer
typeOutput bytes.Buffer
metricsOutput bytes.Buffer
speciesOutput bytes.Buffer
effortValuesOutput bytes.Buffer
)

entry(&entryOutput)
eggGroup(&eggGroupOutput)
eggInformation(&eggGroupOutput)
typing(&typeOutput)
metrics(&metricsOutput)
species(&speciesOutput)
effortValues(&effortValuesOutput)

fmt.Fprintf(&output,
"Your selected Pokémon: %s\n%s\n%s%s%s%s\n",
capitalizedString, entryOutput.String(), typeOutput.String(), metricsOutput.String(), speciesOutput.String(), eggGroupOutput.String(),
"Your selected Pokémon: %s\n%s\n%s%s%s%s%s\n",
capitalizedString, entryOutput.String(), typeOutput.String(), metricsOutput.String(), speciesOutput.String(), eggGroupOutput.String(), effortValuesOutput.String(),
)

if *pf.Image != "" || *pf.ShortImage != "" {
Expand Down
8 changes: 7 additions & 1 deletion cmd/utils/validateargs.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ func ValidateArgs(args []string, v Validator) error {
return err
}
if v.RequireName && len(args) == 2 {
return fmt.Errorf("✖ Error! Please specify a(n) %s", v.CmdName)
errMessage := styling.ErrorBorder.Render(
styling.ErrorColor.Render("✖ Error!"),
fmt.Sprintf("\nPlease declare a(n) %s's name after the <%s> command", v.CmdName, v.CmdName),
fmt.Sprintf("\nRun 'poke-cli %s -h' for more details", v.CmdName),
"\nerror: insufficient arguments",
)
return fmt.Errorf("%s", errMessage)
}
if !v.HasFlags && !v.RequireName {
if err := checkNoOtherOptions(args, v.MaxArgs, v.CmdName); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion docs/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server {
root /usr/share/nginx/html;
index index.html;

add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https:; connect-src 'self';" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https:; connect-src 'self' https://api.github.com;" always;
Comment thread
digitalghost-dev marked this conversation as resolved.
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
Expand Down
2 changes: 1 addition & 1 deletion nfpm.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "poke-cli"
arch: "arm64"
platform: "linux"
version: "v1.9.1"
version: "v1.9.2"
section: "default"
version_schema: semver
maintainer: "Christian S"
Expand Down
27 changes: 9 additions & 18 deletions structs/structs.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
package structs

func (a AbilityJSONStruct) GetResourceName() string {
return a.Name
}
func (a AbilityJSONStruct) GetResourceName() string { return a.Name }

func (i ItemJSONStruct) GetResourceName() string {
return i.Name
}
func (i ItemJSONStruct) GetResourceName() string { return i.Name }

func (m MoveJSONStruct) GetResourceName() string {
return m.Name
}
func (m MoveJSONStruct) GetResourceName() string { return m.Name }

func (p PokemonJSONStruct) GetResourceName() string {
return p.Name
}
func (p PokemonJSONStruct) GetResourceName() string { return p.Name }

func (s PokemonSpeciesJSONStruct) GetResourceName() string {
return s.Name
}
func (s PokemonSpeciesJSONStruct) GetResourceName() string { return s.Name }

func (t TypesJSONStruct) GetResourceName() string {
return t.Name
}
func (t TypesJSONStruct) GetResourceName() string { return t.Name }

// AbilityJSONStruct ability endpoint from API
type AbilityJSONStruct struct {
Expand Down Expand Up @@ -183,6 +171,7 @@ type PokemonJSONStruct struct {
} `json:"sprites"`
Stats []struct {
BaseStat int `json:"base_stat"`
Effort int `json:"effort"`
Stat struct {
Name string `json:"name"`
} `json:"stat"`
Expand Down Expand Up @@ -215,6 +204,8 @@ type PokemonSpeciesJSONStruct struct {
URL string `json:"url"`
} `json:"version"`
} `json:"flavor_text_entries"`
GenderRate int `json:"gender_rate"`
HatchCounter int `json:"hatch_counter"`
}

// TypesJSONStruct type endpoint from API
Expand Down
2 changes: 1 addition & 1 deletion testdata/main_latest_flag.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
┃ ┃
┃ Latest available release ┃
┃ on GitHub: ┃
┃ • v1.9.0
┃ • v1.9.1
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
3 changes: 3 additions & 0 deletions testdata/pokemon_abilities.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ supercomputer, and it uses calculations to analyze foes.
• Height: 1.6m (5′03″)
• Evolves from: Metang
• Egg Group(s): Mineral
• Gender Rate: Genderless
• Egg Cycles: 40
• Effort Values: 3 Def
─────────
Abilities
Ability 1: Clear Body
Expand Down
3 changes: 3 additions & 0 deletions testdata/pokemon_defense.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ look forward to being launched out at Mach speeds.
• Height: 3.0m (9′10″)
• Evolves from: Drakloak
• Egg Group(s): Amorphous, Dragon
• Gender Rate: 50% F
• Egg Cycles: 40
• Effort Values: 3 Spd
─────────────
Type Defenses
Immune: Fighting, Normal
Expand Down
3 changes: 3 additions & 0 deletions testdata/pokemon_defense_ability_immunities.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ escapes.
• Height: 0.9m (2′11″)
• Evolves from: Shellos
• Egg Group(s): Amorphous, Water1
• Gender Rate: 50% F
• Egg Cycles: 20
• Effort Values: 2 HP
─────────────
Type Defenses
Immune: Electric
Expand Down
3 changes: 3 additions & 0 deletions testdata/pokemon_image.golden
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Skeledirge’s head gained a soul.
• Height: 1.6m (5′03″)
• Evolves from: Crocalor
• Egg Group(s): Field
• Gender Rate: 12.5% F
• Egg Cycles: 20
• Effort Values: 3 SpA
─────
Image
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Expand Down
3 changes: 3 additions & 0 deletions testdata/pokemon_image_flag_non-valid_size.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ in the rescues of drowning people.
• Height: 1.1m (3′07″)
• Evolves from: Buizel
• Egg Group(s): Field, Water1
• Gender Rate: 50% F
• Egg Cycles: 20
• Effort Values: 2 Spd
─────
Image
╭───────────────────────────╮
Expand Down
3 changes: 3 additions & 0 deletions testdata/pokemon_no_flags_dual_type.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ Victini always win, regardless of the type of encounter.
• Height: 0.4m (1′04″)
• Basic Pokémon
• Egg Group(s): Undiscovered
• Gender Rate: Genderless
• Egg Cycles: 120
• Effort Values: 3 HP
3 changes: 3 additions & 0 deletions testdata/pokemon_regional_form.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ friendly and never appear to squabble.
• Height: 10.9m (35′09″)
• Evolves from: Exeggcute
• Egg Group(s): Grass
• Gender Rate: 50% F
• Egg Cycles: 20
• Effort Values: 2 SpA
──────────
Base Stats
HP ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 95
Expand Down
3 changes: 3 additions & 0 deletions testdata/pokemon_regional_form_2.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ situation, it remains calm and collected.
• Height: 1.8m (5′11″)
• Evolves from: Slowpoke
• Egg Group(s): Monster, Water1
• Gender Rate: 50% F
• Egg Cycles: 20
• Effort Values: 2 SpD
3 changes: 3 additions & 0 deletions testdata/pokemon_stats.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ stored poison is churned for greater potency.
• Height: 1.3m (4′03″)
• Evolves from: Croagunk
• Egg Group(s): Human-Like
• Gender Rate: 50% F
• Egg Cycles: 20
• Effort Values: 2 Atk
──────────
Base Stats
HP ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 83
Expand Down
2 changes: 1 addition & 1 deletion web/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "web"
version = "1.9.0"
version = "1.9.2"
description = "Streamlit dashboard for browsing and visualizing Pokémon TCG tournament standings and results."
readme = "README.md"
requires-python = ">=3.12"
Expand Down
Loading