Skip to content
Merged

1.6.2 #184

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 @@ -30,7 +30,7 @@ on:
- main

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

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.6.1
- -s -w -X main.version=v1.6.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.6.1" -o poke-cli .
RUN go build -ldflags "-X main.version=v1.6.2" -o poke-cli .

# build 2
FROM --platform=$BUILDPLATFORM alpine:3.22
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 height="250" width="350" src="pokemon.svg" alt="pokemon-logo"/>
<h1>Pokémon CLI</h1>
<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.6.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.6.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 @@ -49,17 +49,17 @@ View future plans in the [Roadmap](#roadmap) section.

### Scoop
1. Add the bucket:
```powershell
```bash
scoop bucket add digitalghost https://github.com/digitalghost-dev/scoop-bucket.git
```

2. Install poke-cli:
```powershell
```bash
scoop install poke-cli
```

3. Verify installation:
```powershell
```bash
poke-cli -v
```

Expand Down Expand Up @@ -91,11 +91,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.6.1 <command> [subcommand] flag]
docker run --rm -it digitalghostdev/poke-cli:v1.6.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.6.1 -c "cd /app && exec sh"
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.6.2 -c "cd /app && exec sh"
# placed into the /app directory, run the program with './poke-cli'
# example: ./poke-cli ability swift-swim
```
Expand Down
2 changes: 2 additions & 0 deletions card_data/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ requires-python = ">=3.12"
dependencies = [
"aws-secretsmanager-caching>=1.1.3",
"dagster>=1.11.3",
"dagster-dbt>=0.27.3",
"dagster-dg-cli>=1.11.3",
"dagster-postgres>=0.27.3",
"dagster-webserver>=1.11.3",
Expand All @@ -27,6 +28,7 @@ dependencies = [
dev = [
"dagster-webserver",
"dagster-dg-cli",
"dagster-dbt>=0.27.3",
"dagster-postgres>=0.27.3",
]

Expand Down
114 changes: 114 additions & 0 deletions card_data/uv.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/pokemon/pokemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func PokemonCommand() (string, error) {
return output.String(), err
}

pokemonSpeciesStruct, err := connections.PokemonSpeciesApiCall("pokemon-species", pokemonName, connections.APIURL)
pokemonSpeciesStruct, err := connections.PokemonSpeciesApiCall("pokemon-species", pokemonStruct.Species.Name, connections.APIURL)
if err != nil {
output.WriteString(err.Error())
return output.String(), err
Expand Down
10 changes: 10 additions & 0 deletions cmd/pokemon/pokemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ func TestPokemonCommand(t *testing.T) {
args: []string{"pokemon", "toxicroak", "--stats"},
expectedOutput: utils.LoadGolden(t, "pokemon_stats.golden"),
},
{
name: "Pokemon regional form",
args: []string{"pokemon", "exeggutor-alola", "--stats"},
expectedOutput: utils.LoadGolden(t, "pokemon_regional_form.golden"),
},
{
name: "Pokemon regional form 2",
args: []string{"pokemon", "slowking-galar"},
expectedOutput: utils.LoadGolden(t, "pokemon_regional_form_2.golden"),
},
}

for _, tt := range tests {
Expand Down
7 changes: 6 additions & 1 deletion connections/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io"
"net/http"
"net/url"
"time"

"github.com/digitalghost-dev/poke-cli/structs"
"github.com/digitalghost-dev/poke-cli/styling"
Expand All @@ -31,7 +32,11 @@ func ApiCallSetup(rawURL string, target interface{}, skipHTTPSCheck bool) error
return errors.New("only HTTPS URLs are allowed for security reasons")
}

res, err := http.Get(parsedURL.String())
client := http.Client{
Timeout: time.Second * 30,
}

res, err := client.Get(parsedURL.String())
if err != nil {
return fmt.Errorf("error making GET request: %w", err)
}
Expand Down
19 changes: 12 additions & 7 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
There are a variety of ways to install the tool and support for different operating systems.

* [Homebrew](#homebrew)
* [Winget](#winget)
* [Scoop](#scoop)
* [Linux Packages](#linux-packages)
* [Docker Image](#docker-image)
* [Binary](#binary)
Expand All @@ -19,14 +19,19 @@ There are a variety of ways to install the tool and support for different operat
poke-cli -v
```

### Winget
1. Install the package:
```powershell
winget install poke-cli
### Scoop
1. Add the bucket:
```bash
scoop bucket add digitalghost https://github.com/digitalghost-dev/scoop-bucket.git
```

2. Verify install:
```console
2. Install poke-cli:
```bash
scoop install poke-cli
```

3. Verify installation:
```bash
poke-cli -v
```

Expand Down
26 changes: 19 additions & 7 deletions flags/pokemonflagset.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,23 @@ func ImageFlag(w io.Writer, endpoint string, pokemonName string, size string) er

// Anonymous function to transform the image to a string
ToString := func(width int, height int, img image.Image) string {
// Resize the image to the specified width, preserving aspect ratio
img = imaging.Resize(img, width, height, imaging.NearestNeighbor)
b := img.Bounds()

imageWidth := b.Max.X
h := b.Max.Y

rowCount := (h - 1) / 2
if h%2 != 0 {
rowCount++
}
estimatedSize := (imageWidth * rowCount * 55) + rowCount

str := strings.Builder{}
str.Grow(estimatedSize)

// Cache for lipgloss styles to avoid recreating identical styles
styleCache := make(map[string]lipgloss.Style)

for heightCounter := 0; heightCounter < h-1; heightCounter += 2 {
for x := 0; x < imageWidth; x++ {
Expand All @@ -347,14 +357,16 @@ func ImageFlag(w io.Writer, endpoint string, pokemonName string, size string) er
c2, _ := styling.MakeColor(img.At(x, heightCounter+1))
color2 := lipgloss.Color(c2.Hex())

// Render the half-block character with the two colors
str.WriteString(lipgloss.NewStyle().
Foreground(color1).
Background(color2).
Render("▀"))
styleKey := string(color1) + "_" + string(color2)
style, exists := styleCache[styleKey]
if !exists {
style = lipgloss.NewStyle().Foreground(color1).Background(color2)
styleCache[styleKey] = style
}

str.WriteString(style.Render("▀"))
}

// Add a newline after each row
str.WriteString("\n")
}

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.6.1"
version: "v1.6.2"
section: "default"
version_schema: semver
maintainer: "Christian S"
Expand Down
4 changes: 4 additions & 0 deletions structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ type PokemonJSONStruct struct {
Name string `json:"name"`
} `json:"stat"`
} `json:"stats"`
Species struct {
Name string `json:"name"`
URL string `json:"url"`
} `json:"species"`
}

// PokemonSpeciesJSONStruct pokemon-species 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
@@ -1,6 +1,6 @@
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ Latest available version: ┃
┃ • v1.6.0
┃ • v1.6.1
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
19 changes: 19 additions & 0 deletions testdata/pokemon_regional_form.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Your selected Pokémon: Exeggutor Alola
Its three heads think independently. However, they are
friendly and never appear to squabble.

Grass Dragon

• National Pokédex #: 10114
• Weight: 415.6kg (916.2 lbs)
• Height: 10.9m (35′09″)
• Evolves from: Exeggcute
──────────
Base Stats
HP ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 95
Atk ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 105
Def ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 85
Sp. Atk ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 125
Sp. Def ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 75
Speed ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 45
Total 530
10 changes: 10 additions & 0 deletions testdata/pokemon_regional_form_2.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Your selected Pokémon: Slowking Galar
It has incredible intellect and intuition. Whatever the
situation, it remains calm and collected.

Poison Psychic

• National Pokédex #: 10172
• Weight: 79.5kg (175.3 lbs)
• Height: 1.8m (5′11″)
• Evolves from: Slowpoke