Skip to content

Commit 716836c

Browse files
Merge pull request #157 from digitalghost-dev/1.3.3
1.3.3
2 parents 361d23a + c144915 commit 716836c

29 files changed

+363
-43
lines changed

.github/workflows/ci.yml

Lines changed: 80 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ on:
1616
- 'README.md'
1717
- '.github/**'
1818
- '.dockerignore'
19+
- 'docs/**'
20+
- 'etl/**'
1921
- '.gitignore'
2022
- 'demo**'
2123
- 'go.mod'
@@ -26,7 +28,7 @@ on:
2628
- main
2729

2830
env:
29-
VERSION_NUMBER: 'v1.3.2'
31+
VERSION_NUMBER: 'v1.3.3'
3032
DOCKERHUB_REGISTRY_NAME: 'digitalghostdev/poke-cli'
3133
AWS_REGION: 'us-west-2'
3234

@@ -53,7 +55,77 @@ jobs:
5355
with:
5456
sarif_file: results.sarif
5557

56-
build-docker-image:
58+
build-docs-docker-image:
59+
runs-on: ubuntu-22.04
60+
needs: [ gosec ]
61+
if: needs.gosec.result == 'success'
62+
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
66+
with:
67+
sparse-checkout: |
68+
docs
69+
70+
- name: Set up Docker Buildx
71+
uses: 'docker/[email protected]'
72+
73+
- name: Prepare Docker Build Context
74+
run: |
75+
mkdir docker-context
76+
rsync -av --exclude=docker-context . docker-context/
77+
78+
- name: Build and Export
79+
uses: 'docker/[email protected]'
80+
with:
81+
context: ./docker-context
82+
file: ./docker-context/docs/Dockerfile
83+
tags: docs:latest
84+
outputs: type=docker,dest=/tmp/docs.tar
85+
86+
- name: Upload Artifact
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: docs
90+
path: /tmp/docs.tar
91+
92+
upload-docs-to-ecr:
93+
runs-on: ubuntu-22.04
94+
needs: [build-docs-docker-image]
95+
if: needs.build-docs-docker-image.result == 'success'
96+
97+
steps:
98+
- name: Checkout
99+
uses: actions/checkout@v4
100+
101+
- name: Configure AWS
102+
uses: aws-actions/configure-aws-credentials@v4
103+
with:
104+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
105+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
106+
aws-region: ${{ env.AWS_REGION }}
107+
108+
- name: Login to Amazon ECR
109+
id: login-ecr
110+
uses: aws-actions/amazon-ecr-login@v2
111+
112+
- name: Download Artifact
113+
uses: actions/download-artifact@v4
114+
with:
115+
name: docs
116+
path: /tmp
117+
118+
- name: Load Image
119+
run: docker load -i /tmp/docs.tar
120+
121+
- name: Tag and Push
122+
run: |
123+
docker tag docs:latest ${{ secrets.AWS_DOCS_ECR_NAME }}:latest
124+
docker push ${{ secrets.AWS_DOCS_ECR_NAME }}:latest
125+
126+
# AWS will then take care of updating App Runner with the latest version
127+
128+
build-cli-docker-image:
57129
runs-on: ubuntu-22.04
58130
needs: [gosec]
59131
if: needs.gosec.result == 'success'
@@ -83,11 +155,11 @@ jobs:
83155
name: poke-cli
84156
path: /tmp/poke-cli.tar
85157

86-
# Uploading to Elastic Container Registry has a backup method.
87-
upload-to-ecr:
158+
# Uploading to Elastic Container Registry as a backup method.
159+
upload-cli-to-ecr:
88160
runs-on: ubuntu-22.04
89-
needs: [build-docker-image]
90-
if: needs.build-docker-image.result == 'success'
161+
needs: [build-cli-docker-image]
162+
if: needs.build-cli-docker-image.result == 'success'
91163

92164
steps:
93165
- name: Checkout
@@ -116,8 +188,8 @@ jobs:
116188
id-token: 'write'
117189

118190
runs-on: ubuntu-22.04
119-
needs: [build-docker-image]
120-
if: needs.build-docker-image.result == 'success'
191+
needs: [build-cli-docker-image]
192+
if: needs.build-cli-docker-image.result == 'success'
121193

122194
steps:
123195
- name: Checkout

.gitignore

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

2727
# env file
28-
.env
28+
.env
29+
30+
# Python
31+
etl/.venv

.goreleaser.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ builds:
1414
- windows
1515
- darwin
1616
ldflags:
17-
- -s -w -X main.version=v1.3.2
17+
- -s -w -X main.version=v1.3.3
1818

1919
archives:
20-
- format: tar.gz
20+
- formats: [ 'zip' ]
2121
name_template: >-
2222
{{ .ProjectName }}_
2323
{{- title .Os }}_
@@ -28,7 +28,7 @@ archives:
2828
# use zip for windows archives
2929
format_overrides:
3030
- goos: windows
31-
format: zip
31+
- formats: [ 'zip' ]
3232

3333
changelog:
3434
sort: asc
@@ -37,11 +37,20 @@ changelog:
3737
- "^docs:"
3838
- "^test:"
3939

40-
brews:
41-
- repository:
40+
homebrew_casks:
41+
- name: poke-cli
42+
conflicts:
43+
- formula: poke-cli
44+
repository:
4245
owner: digitalghost-dev
4346
name: homebrew-poke-cli
4447
token: "{{.Env.GITHUB_TOKEN}}"
4548
homepage: "https://github.com/digitalghost-dev/poke-cli"
46-
description: "A CLI tool written in Go that allows you to view data about Pokémon from the terminal."
49+
description: "A hybrid CLI/TUI tool written in Go for viewing Pokémon data from the terminal!"
4750
license: "Apache License 2.0"
51+
hooks:
52+
post:
53+
install: |
54+
if system_command("/usr/bin/xattr", args: ["-h"]).exit_status == 0
55+
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/poke-cli"]
56+
end

Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
# build 1
2-
FROM golang:1.24.4-alpine3.21 AS build
1+
# Stage 1: Dependencies
2+
FROM golang:1.24.4-alpine3.21 AS deps
33

44
WORKDIR /app
55

66
COPY go.mod go.sum ./
7-
RUN go mod download
7+
RUN go mod tidy
88

9+
# Stage 2: Build
10+
FROM deps AS build-stage
911
COPY . .
1012

11-
RUN go build -ldflags "-X main.version=v1.3.2" -o poke-cli .
13+
RUN go build -ldflags "-X main.version=v1.3.3" -o poke-cli .
1214

13-
# build 2
15+
# Stage 3: Production
1416
FROM --platform=$BUILDPLATFORM alpine:latest
1517

1618
# Install only necessary packages and remove them after use
@@ -19,7 +21,7 @@ RUN apk add --no-cache shadow && \
1921
sed -i 's/^root:.*/root:!*:0:0:root:\/root:\/sbin\/nologin/' /etc/passwd && \
2022
apk del shadow
2123

22-
COPY --from=build /app/poke-cli /app/poke-cli
24+
COPY --from=build-stage /app/poke-cli /app/poke-cli
2325

2426
ENV TERM=xterm-256color
2527
ENV COLOR_OUTPUT=true

README.md

Lines changed: 5 additions & 4 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.3.2?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.3.3?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">
@@ -13,6 +13,7 @@
1313

1414
## Overview
1515
`poke-cli` is a hybrid of a classic CLI and a modern TUI tool for viewing data about Pokémon! This is my first Go project.
16+
View the [documentation](https://docs.poke-cli.com)!
1617

1718
The architecture behind how the tool works is straight forward:
1819
1. Each command indicates which [API](https://pokeapi.co/) endpoint to use.
@@ -23,7 +24,7 @@ View future plans in the [Roadmap](#roadmap) section.
2324

2425
---
2526
## Demo
26-
![demo](https://poke-cli-s3-bucket.s3.us-west-2.amazonaws.com/demo-v1.2.1.gif)
27+
![demo](https://poke-cli-s3-bucket.s3.us-west-2.amazonaws.com/demo-v1.3.3.gif)
2728

2829
---
2930
## Installation
@@ -76,11 +77,11 @@ View future plans in the [Roadmap](#roadmap) section.
7677
3. Choose how to interact with the container:
7778
* Run a single command and exit:
7879
```bash
79-
docker run --rm -it digitalghostdev/poke-cli:v1.3.2 <command> [subcommand] flag]
80+
docker run --rm -it digitalghostdev/poke-cli:v1.3.3 <command> [subcommand] flag]
8081
```
8182
* Enter the container and use its shell:
8283
```bash
83-
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.3.2 -c "cd /app && exec sh"
84+
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.3.3 -c "cd /app && exec sh"
8485
# placed into the /app directory, run the program with './poke-cli'
8586
# example: ./poke-cli ability swift-swim
8687
```

cli.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ func runCLI(args []string) int {
7474
"\n\n", styling.StyleItalic.Render("hint: when calling a resource with a space, use a hyphen"),
7575
"\n", styling.StyleItalic.Render("example: poke-cli ability strong-jaw"),
7676
"\n", styling.StyleItalic.Render("example: poke-cli pokemon flutter-mane"),
77+
"\n\n", fmt.Sprintf("%s %s", "↓ ctrl/cmd + click for docs/guides\n", styling.DocsLink),
7778
)
7879
fmt.Println(helpMessage)
7980
}

cmd/ability/ability.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,21 @@ func AbilityCommand() (string, error) {
8888
capitalizedAbility := cases.Title(language.English).String(strings.ReplaceAll(abilityName, "-", " "))
8989
output.WriteString(styling.StyleBold.Render(capitalizedAbility) + "\n")
9090

91-
// API is missing some data for the short_effect for abilities from Generation 9.
92-
// If short_effect is empty, fallback to the move's flavor_text_entry.
93-
if englishShortEffect == "" {
94-
output.WriteString("Effect: " + englishFlavorEntry + "\n")
95-
} else {
96-
output.WriteString("Effect: " + englishShortEffect + "\n")
97-
}
98-
99-
// Print the generation where the move was first introduced.
91+
// Print the generation where the ability was first introduced.
10092
generationParts := strings.Split(abilitiesStruct.Generation.Name, "-")
10193
if len(generationParts) > 1 {
10294
generationUpper := strings.ToUpper(generationParts[1])
103-
output.WriteString("Generation: " + generationUpper + "\n")
95+
output.WriteString(fmt.Sprintf("%s First introduced in generation "+generationUpper+"\n", styling.ColoredBullet))
96+
} else {
97+
output.WriteString(fmt.Sprintf("%s Generation: Unknown\n", styling.ColoredBullet))
98+
}
99+
100+
// API is missing some data for the short_effect for abilities from Generation 9.
101+
// If short_effect is empty, fallback to the move's flavor_text_entry.
102+
if englishShortEffect == "" {
103+
output.WriteString(fmt.Sprintf("%s Effect: "+englishFlavorEntry, styling.ColoredBullet))
104104
} else {
105-
output.WriteString("Generation: Unknown\n")
105+
output.WriteString(fmt.Sprintf("%s Effect: "+englishShortEffect, styling.ColoredBullet))
106106
}
107107

108108
if *pokemonFlag || *shortPokemonFlag {

demo.gif

114 KB
Loading

demo.tape

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ Set Shell "bash"
6363
Set FontSize 32
6464
Set Width 2100
6565
Set Height 1300
66-
Set TypingSpeed 85ms
66+
Set TypingSpeed 100ms
67+
Set Theme "tokyonight-storm"
6768

6869
Type "poke-cli pokemon charizard --abilities --stats --types"
6970

docs/.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Environments
2+
.env
3+
.venv

0 commit comments

Comments
 (0)