Skip to content

Commit 8329b94

Browse files
Merge pull request #124 from digitalghost-dev/1.1.0
1.1.0
2 parents 4f1dde6 + 9d8c75f commit 8329b94

37 files changed

+1027
-204
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626
- main
2727

2828
env:
29-
VERSION_NUMBER: 'v1.0.3'
29+
VERSION_NUMBER: 'v1.1.0'
3030
DOCKERHUB_REGISTRY_NAME: 'digitalghostdev/poke-cli'
3131
AWS_REGION: 'us-west-2'
3232

@@ -185,7 +185,7 @@ jobs:
185185
strategy:
186186
fail-fast: false
187187
matrix:
188-
platform: [linux/amd64, linux/arm64]
188+
platform: [linux/amd64, linux/arm64, windows/amd64, windows/arm64]
189189

190190
steps:
191191
- name: Checkout

.github/workflows/go_lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
go-version: 1.23
2222

2323
- name: Lint
24-
uses: golangci/golangci-lint-action@v6
24+
uses: golangci/golangci-lint-action@v7
2525
with:
26-
version: v1.61
26+
version: v2.0.1
2727
skip-cache: true

.golangci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: "2"
2+
linters:
3+
default: none
4+
enable:
5+
- bodyclose
6+
- errcheck
7+
- govet
8+
- ineffassign
9+
- perfsprint
10+
- staticcheck
11+
- testifylint
12+
- unused
13+
- whitespace
14+
exclusions:
15+
generated: lax
16+
presets:
17+
- comments
18+
- common-false-positives
19+
- legacy
20+
- std-error-handling
21+
paths:
22+
- third_party$
23+
- builtin$
24+
- examples$
25+
formatters:
26+
exclusions:
27+
generated: lax
28+
paths:
29+
- third_party$
30+
- builtin$
31+
- examples$

.goreleaser.yaml

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.0.3
17+
- -s -w -X main.version=v1.1.0
1818

1919
archives:
2020
- format: tar.gz

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.0.3" -o poke-cli .
11+
RUN go build -ldflags "-X main.version=v1.1.0" -o poke-cli .
1212

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

README.md

Lines changed: 22 additions & 8 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.0.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.1.0?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">
@@ -28,8 +28,12 @@ View future plans in the [Roadmap](#roadmap) section.
2828
---
2929
## Installation
3030

31+
* [Binary](#binary)
32+
* [Docker Image](#docker-image)
33+
* [Homebrew](#homebrew)
34+
* [Source](#source)
35+
3136
### Binary
32-
_Download a pre-built binary_
3337

3438
1. Head to the [releases](https://github.com/digitalghost-dev/poke-cli/releases) page of the project.
3539
2. Choose a version to download. The latest is best.
@@ -60,7 +64,6 @@ _Download a pre-built binary_
6064
```
6165

6266
### Docker Image
63-
_Use a Docker Image_
6467

6568
1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop/).
6669
2. Once installed, use the command below to pull the image and run the container!
@@ -73,23 +76,32 @@ _Use a Docker Image_
7376
3. Choose how to interact with the container:
7477
* Run a single command and exit:
7578
```bash
76-
docker run --rm -it digitalghostdev/poke-cli:v1.0.3 <command> [subcommand] flag]
79+
docker run --rm -it digitalghostdev/poke-cli:v1.1.0 <command> [subcommand] flag]
7780
```
7881
* Enter the container and use its shell:
7982
```bash
80-
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.0.3 -c "cd /app && exec sh"
83+
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.1.0 -c "cd /app && exec sh"
8184
# placed into the /app directory, run the program with './poke-cli'
8285
# example: ./poke-cli ability swift-swim
8386
```
87+
88+
### Homebrew
89+
```bash
90+
brew tap digitalghost-dev/poke-cli
91+
brew install poke-cli
8492
85-
### Go Install
86-
_If you have Go already, install the executable yourself._
93+
# verify
94+
poke-cli -v
95+
```
96+
97+
### Source
8798

8899
1. Run the following command:
89100
```bash
90101
go install github.com/digitalghost-dev/poke-cli@latest
91102
```
92103
2. The tool is ready to use!
104+
93105
---
94106
## Usage
95107
By running `poke-cli [-h | --help]`, it'll display information on how to use the tool.
@@ -111,6 +123,7 @@ By running `poke-cli [-h | --help]`, it'll display information on how to use the
111123
│ ability Get details about an ability │
112124
│ natures Get details about all natures │
113125
│ pokemon Get details about a Pokémon │
126+
│ search Search for a resource │
114127
│ types Get details about a typing │
115128
│ │
116129
│ hint: when calling a resource with a space, use a hyphen │
@@ -127,6 +140,7 @@ Below is a list of the planned/completed commands and flags:
127140
- [x] `ability`: get data about a specific ability.
128141
- [x] `-p | --pokemon`: display Pokémon that learn this ability.
129142
- [ ] `berry`: get data about a specific berry.
143+
- [ ] `item`: get data about a specific item.
130144
- [ ] `move`: get data about a specific move.
131145
- [ ] `-p | --pokemon`: display Pokémon that learn this move.
132146
- [x] `natures`: get data about natures.
@@ -136,7 +150,7 @@ Below is a list of the planned/completed commands and flags:
136150
- [x] `-s | --stats`: display the Pokémon's base stats.
137151
- [x] `-t | --types`: display the Pokémon's typing.
138152
- [ ] `-m | --moves`: display learnable moves.
139-
- [ ] `search`: search for a resource (`ability`, `berry`, `pokemon`, `move`)
153+
- [x] `search`: search for a resource (`ability`, `berry`, `pokemon`, `move`)
140154
- [ ] `speed`: compare speed stats between two Pokémon.
141155
- [x] `types`: get data about a specific typing.
142156

cli.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"flag"
55
"fmt"
66
"github.com/digitalghost-dev/poke-cli/cmd"
7+
"github.com/digitalghost-dev/poke-cli/cmd/search"
78
"github.com/digitalghost-dev/poke-cli/flags"
89
"github.com/digitalghost-dev/poke-cli/styling"
910
"os"
@@ -59,6 +60,7 @@ func runCLI(args []string) int {
5960
fmt.Sprintf("\n\t%-15s %s", "ability", "Get details about an ability"),
6061
fmt.Sprintf("\n\t%-15s %s", "natures", "Get details about all natures"),
6162
fmt.Sprintf("\n\t%-15s %s", "pokemon", "Get details about a Pokémon"),
63+
fmt.Sprintf("\n\t%-15s %s", "search", "Search for a resource"),
6264
fmt.Sprintf("\n\t%-15s %s", "types", "Get details about a typing"),
6365
"\n\n", styling.StyleItalic.Render("hint: when calling a resource with a space, use a hyphen"),
6466
"\n", styling.StyleItalic.Render("example: poke-cli ability strong-jaw"),
@@ -88,6 +90,7 @@ func runCLI(args []string) int {
8890
"natures": cmd.NaturesCommand,
8991
"pokemon": cmd.PokemonCommand,
9092
"types": cmd.TypesCommand,
93+
"search": search.SearchCommand,
9194
}
9295

9396
if len(os.Args) < 2 {
@@ -111,6 +114,7 @@ func runCLI(args []string) int {
111114
fmt.Sprintf("\n\t%-15s %s", "ability", "Get details about an ability"),
112115
fmt.Sprintf("\n\t%-15s %s", "natures", "Get details about all natures"),
113116
fmt.Sprintf("\n\t%-15s %s", "pokemon", "Get details about a Pokémon"),
117+
fmt.Sprintf("\n\t%-15s %s", "search", "Search for a resource"),
114118
fmt.Sprintf("\n\t%-15s %s", "types", "Get details about a typing"),
115119
fmt.Sprintf("\n\nAlso run %s for more info!", styling.StyleBold.Render("poke-cli -h")),
116120
)

cli_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ func TestRunCLI(t *testing.T) {
112112
"│ ability Get details about an ability │\n" +
113113
"│ natures Get details about all natures │\n" +
114114
"│ pokemon Get details about a Pokémon │\n" +
115+
"│ search Search for a resource │\n" +
115116
"│ types Get details about a typing │\n" +
116117
"│ │\n" +
117118
"│ hint: when calling a resource with a space, use a hyphen │\n" +
@@ -140,6 +141,7 @@ func TestRunCLI(t *testing.T) {
140141
"│ ability Get details about an ability │\n" +
141142
"│ natures Get details about all natures │\n" +
142143
"│ pokemon Get details about a Pokémon │\n" +
144+
"│ search Search for a resource │\n" +
143145
"│ types Get details about a typing │\n" +
144146
"│ │\n" +
145147
"│ hint: when calling a resource with a space, use a hyphen │\n" +
@@ -168,6 +170,7 @@ func TestRunCLI(t *testing.T) {
168170
"│ ability Get details about an ability │\n" +
169171
"│ natures Get details about all natures │\n" +
170172
"│ pokemon Get details about a Pokémon │\n" +
173+
"│ search Search for a resource │\n" +
171174
"│ types Get details about a typing │\n" +
172175
"│ │\n" +
173176
"│ hint: when calling a resource with a space, use a hyphen │\n" +
@@ -183,12 +186,6 @@ func TestRunCLI(t *testing.T) {
183186
expectedOutput: "Error!",
184187
expectedCode: 1,
185188
},
186-
{
187-
name: "Latest Flag",
188-
args: []string{"-l"},
189-
expectedOutput: "Latest Docker image version: v1.0.2\nLatest release tag: v1.0.2\n",
190-
expectedCode: 0,
191-
},
192189
}
193190

194191
for _, tt := range tests {

cmd/ability.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
)
1414

1515
func AbilityCommand() {
16-
1716
flag.Usage = func() {
1817
helpMessage := styling.HelpBorder.Render(
1918
"Get details about a specific ability.\n\n",
@@ -52,7 +51,7 @@ func AbilityCommand() {
5251
}
5352
}
5453

55-
abilitiesStruct, abilityName, err := connections.AbilityApiCall(endpoint, abilityName, "https://pokeapi.co/api/v2/")
54+
abilitiesStruct, abilityName, err := connections.AbilityApiCall(endpoint, abilityName, connections.APIURL)
5655
if err != nil {
5756
fmt.Println(err)
5857
if os.Getenv("GO_TESTING") != "1" {
@@ -78,7 +77,7 @@ func AbilityCommand() {
7877
}
7978
}
8079

81-
capitalizedAbility := cases.Title(language.English).String(strings.Replace(abilityName, "-", " ", -1))
80+
capitalizedAbility := cases.Title(language.English).String(strings.ReplaceAll(abilityName, "-", " "))
8281
fmt.Println(styling.StyleBold.Render(capitalizedAbility))
8382

8483
// API is missing some data for the short_effect for abilities from Generation 9.

cmd/ability_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ func TestAbilityCommand(t *testing.T) {
103103
AbilityCommand()
104104
})
105105

106-
if !strings.Contains(output, tt.expectedOutput) {
106+
cleanOutput := styling.StripANSI(output)
107+
108+
if !strings.Contains(cleanOutput, tt.expectedOutput) {
107109
t.Errorf("Output mismatch. Expected to contain:\n%s\nGot:\n%s", tt.expectedOutput, output)
108110
}
109111
})

0 commit comments

Comments
 (0)