Skip to content

Commit 4dc2144

Browse files
Merge pull request #172 from digitalghost-dev/1.5.1
1.5.1
2 parents 0451b1b + d5f75a8 commit 4dc2144

37 files changed

+179
-88
lines changed

.dockerignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,7 @@ go.work.sum
2525
dist/
2626

2727
# testdata
28-
testdata/
28+
testdata/
29+
30+
# Python data
31+
card_data/

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ on:
2828
- main
2929

3030
env:
31-
VERSION_NUMBER: 'v1.5.0'
31+
VERSION_NUMBER: 'v1.5.1'
3232
DOCKERHUB_REGISTRY_NAME: 'digitalghostdev/poke-cli'
3333
AWS_REGION: 'us-west-2'
3434

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ card_data/.venv
3232
__pycache__/
3333

3434
# Terraform
35-
card_data/terraform/access-token
36-
/card_data/terraform/access-token
37-
card_data/terraform/secrets.tfvars
38-
card_data/terraform/terraform.tfstate
39-
/card_data/terraform/.terraform/
35+
card_data/infra/access-token
36+
/card_data/infra/access-token
37+
card_data/infra/secrets.tfvars
38+
card_data/infra/terraform.tfstate
39+
/card_data/infra/.terraform/

.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.5.0
17+
- -s -w -X main.version=v1.5.1
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.5.0" -o poke-cli .
11+
RUN go build -ldflags "-X main.version=v1.5.1" -o poke-cli .
1212

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

README.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img height="250" width="350" src="pokemon.svg" alt="pokemon-logo"/>
33
<h1>Pokémon CLI</h1>
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.5.0?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.5.1?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">
@@ -24,7 +24,7 @@ View future plans in the [Roadmap](#roadmap) section.
2424

2525
---
2626
## Demo
27-
![demo](https://poke-cli-s3-bucket.s3.us-west-2.amazonaws.com/demo-v1.5.0.gif)
27+
![demo](https://poke-cli-s3-bucket.s3.us-west-2.amazonaws.com/demo-v1.5.1.gif)
2828

2929
---
3030
## Installation
@@ -78,11 +78,11 @@ View future plans in the [Roadmap](#roadmap) section.
7878
3. Choose how to interact with the container:
7979
* Run a single command and exit:
8080
```bash
81-
docker run --rm -it digitalghostdev/poke-cli:v1.5.0 <command> [subcommand] flag]
81+
docker run --rm -it digitalghostdev/poke-cli:v1.5.1 <command> [subcommand] flag]
8282
```
8383
* Enter the container and use its shell:
8484
```bash
85-
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.5.0 -c "cd /app && exec sh"
85+
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.5.1 -c "cd /app && exec sh"
8686
# placed into the /app directory, run the program with './poke-cli'
8787
# example: ./poke-cli ability swift-swim
8888
```
@@ -118,7 +118,7 @@ View future plans in the [Roadmap](#roadmap) section.
118118

119119
---
120120
## Usage
121-
By running `poke-cli [-h | --help]`, it'll display information on how to use the tool.
121+
By running `poke-cli [-h | --help]`, it'll display information on how to use the tool or check out the [docs](https://docs.poke-cli.com/)!
122122
```
123123
╭───────────────────────────────────────────────────────────────╮
124124
│Welcome! This tool displays data related to Pokémon! │
@@ -166,9 +166,9 @@ Below is a list of the planned/completed commands and flags:
166166
- [x] `natures`: get data about natures.
167167
- [x] `pokemon`: get data about a Pokémon.
168168
- [x] `-a | --abilities`: display the Pokémon's abilities.
169+
- [ ] `-d | --defense`: display the Pokémon's type defences.
169170
- [x] `-i | --image`: display a pixel image of the Pokémon.
170171
- [x] `-s | --stats`: display the Pokémon's base stats.
171-
- [x] `-t | --types`: display the Pokémon's typing.
172172
- [x] `-m | --moves`: display learnable moves.
173173
- [ ] `search`: search for a resource
174174
- [x] `ability`
@@ -181,13 +181,14 @@ Below is a list of the planned/completed commands and flags:
181181

182182
---
183183
## Tested Terminals
184-
| OS | Terminal | Status | Issues |
185-
|---------|-------------------|:------:|-------------------------------|
186-
| macOS | Ghostty || None |
187-
| macOS | Alacritty || None |
188-
| macOS | HyperJS || None |
189-
| macOS | iTerm2 || None |
190-
| macOS | macOS Terminal | ⚠️ | Images do not render properly |
191-
| Windows | Windows Terminal || None |
192-
| Ubuntu | Standard Terminal || None |
193-
| Ubuntu | Tabby || None |
184+
| Terminal | OS | Status | Issues |
185+
|------------------|:-------------------------:|:------:|-----------------------------------------|
186+
| Alacritty | macOS, Ubuntu,<br>Windows || None |
187+
| Ghostty | macOS || None |
188+
| HyperJS | macOS || None |
189+
| iTerm2 | macOS || None |
190+
| Linux Terminal | Ubuntu || None |
191+
| macOS Terminal | macOS | ⚠️ | `pokemon [name] --image=xx` flag issues |
192+
| Tabby | Ubuntu || None |
193+
| WezTerm | macOS, Windows || None |
194+
| Windows Terminal | Windows || None |

cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func runCLI(args []string) int {
135135
return cmdFunc()
136136
default:
137137
errMessage := styling.ErrorBorder.Render(
138-
styling.ErrorColor.Render("Error!"),
138+
styling.ErrorColor.Render("Error!"),
139139
fmt.Sprintf("\n\t%-15s", fmt.Sprintf("'%s' is not a valid command.\n", cmdArg)),
140140
styling.StyleBold.Render("\nCommands:"),
141141
fmt.Sprintf("\n\t%-15s %s", "ability", "Get details about an ability"),

cmd/pokemon/pokemon.go

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package pokemon
22

33
import (
4+
"bytes"
45
"flag"
56
"fmt"
7+
"github.com/charmbracelet/lipgloss"
68
"github.com/digitalghost-dev/poke-cli/cmd/utils"
79
"github.com/digitalghost-dev/poke-cli/connections"
810
"github.com/digitalghost-dev/poke-cli/flags"
911
"github.com/digitalghost-dev/poke-cli/styling"
1012
"golang.org/x/text/cases"
1113
"golang.org/x/text/language"
14+
"io"
1215
"math"
1316
"os"
1417
"strings"
@@ -21,6 +24,7 @@ func PokemonCommand() (string, error) {
2124
hintMessage := styling.StyleItalic.Render("options: [sm, md, lg]")
2225

2326
flag.Usage = func() {
27+
styledFlag := styling.ErrorColor.Render(fmt.Sprintf("%-30s", "-t, --types"))
2428
helpMessage := styling.HelpBorder.Render(
2529
"Get details about a specific Pokémon.\n\n",
2630
styling.StyleBold.Render("USAGE:"),
@@ -33,7 +37,7 @@ func PokemonCommand() (string, error) {
3337
fmt.Sprintf("\n\t%5s%-15s", "", hintMessage),
3438
fmt.Sprintf("\n\t%-30s %s", "-m, --moves", "Prints the Pokemon's learnable moves."),
3539
fmt.Sprintf("\n\t%-30s %s", "-s, --stats", "Prints the Pokémon's base stats."),
36-
fmt.Sprintf("\n\t%-30s %s", "-t, --types", "Prints the Pokémon's typing."),
40+
fmt.Sprintf("\n\t%s %s", styledFlag, styling.ErrorColor.Render("Deprecated. Types are included with each Pokémon.")),
3741
fmt.Sprintf("\n\t%-30s %s", "-h, --help", "Prints the help menu."),
3842
)
3943
output.WriteString(helpMessage)
@@ -88,11 +92,39 @@ func PokemonCommand() (string, error) {
8892
inches = 0
8993
}
9094

95+
typing := func(w io.Writer) {
96+
var typeBoxes []string
97+
98+
for _, pokeType := range pokemonStruct.Types {
99+
colorHex, exists := styling.ColorMap[pokeType.Type.Name]
100+
if exists {
101+
color := lipgloss.Color(colorHex)
102+
typeColorStyle := lipgloss.NewStyle().
103+
Align(lipgloss.Center).
104+
Foreground(lipgloss.Color("#FAFAFA")).
105+
Background(color).
106+
Margin(1, 1, 0, 0).
107+
Height(1).
108+
Width(14)
109+
110+
rendered := typeColorStyle.Render(cases.Title(language.English).String(pokeType.Type.Name))
111+
typeBoxes = append(typeBoxes, rendered)
112+
}
113+
}
114+
115+
joinedTypes := lipgloss.JoinHorizontal(lipgloss.Top, typeBoxes...)
116+
fmt.Fprintln(w, joinedTypes)
117+
}
118+
119+
var typeOutput bytes.Buffer
120+
typing(&typeOutput)
121+
91122
output.WriteString(fmt.Sprintf(
92-
"Your selected Pokémon: %s\n%s National Pokédex #: %d\n%s Weight: %.1fkg (%.1f lbs)\n%s Height: %.1fm (%d′%02d″)\n",
93-
capitalizedString, styling.ColoredBullet, pokemonStruct.ID,
123+
"Your selected Pokémon: %s\n%s\n%s National Pokédex #: %d\n%s Weight: %.1fkg (%.1f lbs)\n%s Height: %.1fm (%d′%02d″)\n",
124+
capitalizedString, typeOutput.String(),
125+
styling.ColoredBullet, pokemonStruct.ID,
94126
styling.ColoredBullet, weightKilograms, weightPounds,
95-
styling.ColoredBullet, heightFeet, feet, inches,
127+
styling.ColoredBullet, heightMeters, feet, inches,
96128
))
97129

98130
if *imageFlag != "" || *shortImageFlag != "" {

cmd/pokemon/pokemon_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ func TestPokemonCommand(t *testing.T) {
3232
args: []string{"pokemon", "--help"},
3333
expectedOutput: utils.LoadGolden(t, "pokemon_help.golden"),
3434
},
35+
{
36+
name: "Pokemon no flags with dual type",
37+
args: []string{"pokemon", "victini"},
38+
expectedOutput: utils.LoadGolden(t, "pokemon_no_flags_dual_type.golden"),
39+
expectedError: true,
40+
},
3541
{
3642
name: "Pokemon abilities flag",
3743
args: []string{"pokemon", "metagross", "--abilities"},
@@ -65,11 +71,6 @@ func TestPokemonCommand(t *testing.T) {
6571
args: []string{"pokemon", "toxicroak", "--stats"},
6672
expectedOutput: utils.LoadGolden(t, "pokemon_stats.golden"),
6773
},
68-
{
69-
name: "Pokemon typed flags",
70-
args: []string{"pokemon", "armarouge", "--types"},
71-
expectedOutput: utils.LoadGolden(t, "pokemon_types.golden"),
72-
},
7374
}
7475

7576
for _, tt := range tests {

cmd/search/model_input.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func UpdateInput(msg tea.Msg, m Model) (tea.Model, tea.Cmd) {
3131

3232
// checking for blank queries
3333
if strings.TrimSpace(searchTerm) == "" {
34-
errMessage := styling.ErrorBorder.Render(styling.ErrorColor.Render("Error!"), "\nNo blank queries")
34+
errMessage := styling.ErrorBorder.Render(styling.ErrorColor.Render("Error!"), "\nNo blank queries")
3535
m.WarningMessage = errMessage
3636
return m, nil
3737
}

0 commit comments

Comments
 (0)