Skip to content
Merged

1.9.3 #268

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5b136e3
upgrading `charm` libraries to `v2` (#264)
digitalghost-dev Apr 15, 2026
14c424f
upgrading `charm` libraries to `v2` (#264)
digitalghost-dev Apr 15, 2026
77ca3a6
upgrading `charm` libraries to `v2` (#264)
digitalghost-dev Apr 15, 2026
b51da60
upgrading `charm` libraries to `v2` (#264)
digitalghost-dev Apr 15, 2026
c7b144a
upgrading `charm` libraries to `v2` (#264)
digitalghost-dev Apr 16, 2026
68024c0
upgrading `charm` libraries to `v2` (#264)
digitalghost-dev Apr 16, 2026
b7ee4e2
moving form to own file to keep compatibility with `v1` libraries (#264)
digitalghost-dev Apr 16, 2026
5be2547
upgrading `charm` libraries to `v2` (#264)
digitalghost-dev Apr 16, 2026
5fbbc0c
updating version numbers
digitalghost-dev Apr 16, 2026
3338e25
upgrading `charm` libraries to `v2` (#264)
digitalghost-dev Apr 16, 2026
1bf1478
upgrading `charm` libraries to `v2` (#264)
digitalghost-dev Apr 17, 2026
703ebd9
adding paths to ignore
digitalghost-dev Apr 17, 2026
4148200
tidy
digitalghost-dev Apr 17, 2026
7baaf7d
updating paths to ignore
digitalghost-dev Apr 17, 2026
e58c898
updating test data (#266)
digitalghost-dev Apr 17, 2026
91f99e0
updating tests
digitalghost-dev Apr 17, 2026
35c7460
adding `FormatError` function (#267)
digitalghost-dev Apr 17, 2026
b668267
fixing flag parsing error handling (#266)
digitalghost-dev Apr 17, 2026
4752ce9
applying
digitalghost-dev Apr 17, 2026
2c99922
guard `HasDarkBackground` with TTY check to prevent blocking in non-T…
digitalghost-dev Apr 18, 2026
5bdc1db
mod tidy
digitalghost-dev Apr 18, 2026
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.2'
VERSION_NUMBER: 'v1.9.3'
DOCKERHUB_REGISTRY_NAME: 'digitalghostdev/poke-cli'
AWS_REGION: 'us-west-2'

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ web/.coverage
# Python
card_data/.venv
__pycache__/
.ruff_cache/

# Terraform
.terraformrc
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.2
- -s -w -X main.version=v1.9.3

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.2" -o poke-cli .
RUN go build -ldflags "-X main.version=v1.9.3" -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.2?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.3?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.2 <command> [subcommand] [flag]
docker run --rm -it digitalghostdev/poke-cli:v1.9.3 <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.2 -c "cd /app && exec sh"
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.9.3 -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.2 card
> docker run --rm -it -e TERM -e KITTY_WINDOW_ID digitalghostdev/poke-cli:v1.9.3 card
>
> # WezTerm, iTerm2, Ghostty, Konsole, Rio, Tabby
> docker run --rm -it -e TERM -e TERM_PROGRAM digitalghostdev/poke-cli:v1.9.2 card
> docker run --rm -it -e TERM -e TERM_PROGRAM digitalghostdev/poke-cli:v1.9.3 card
>
> # Windows Terminal (Sixel)
> docker run --rm -it -e WT_SESSION digitalghostdev/poke-cli:v1.9.2 card
> docker run --rm -it -e WT_SESSION digitalghostdev/poke-cli:v1.9.3 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.2'
version: '1.9.3'

profile: 'poke_cli_dbt'

Expand Down
13 changes: 5 additions & 8 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,11 @@ func runCLI(args []string) int {
case exists:
return cmdFunc()
default:
errMessage := styling.ErrorBorder.Render(
styling.ErrorColor.Render("✖ Error!"),
fmt.Sprintf("\n\t%-15s", fmt.Sprintf("'%s' is not a valid command.\n", cmdArg)),
styling.StyleBold.Render("\nCommands:"),
renderCommandList(),
fmt.Sprintf("\n\nAlso run %s for more info!", styling.StyleBold.Render("poke-cli -h")),
)
output.WriteString(errMessage)
msg := fmt.Sprintf("\t%-15s", fmt.Sprintf("'%s' is not a valid command.\n", cmdArg)) +
styling.StyleBold.Render("\nCommands:") +
renderCommandList() +
fmt.Sprintf("\n\nAlso run %s for more info!", styling.StyleBold.Render("poke-cli -h"))
output.WriteString(utils.FormatError(msg))

fmt.Println(output.String())

Expand Down
6 changes: 3 additions & 3 deletions cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ func TestRunCLI_VariousCommands(t *testing.T) {
args []string
expected int
}{
//{"Invalid command", []string{"foobar"}, 1},
{"Invalid command", []string{"foobar"}, 1},
{"Latest flag long", []string{"--latest"}, 0},
{"Latest flag short", []string{"-l"}, 0},
{"Version flag long", []string{"--version"}, 0},
{"Version flag short", []string{"-v"}, 0},
{"Search command with invalid args", []string{"search", "pokemon", "extra-arg"}, 1},
//{"Missing Pokémon name", []string{"pokemon"}, 1},
//{"Another invalid command", []string{"invalid"}, 1},
{"Missing Pokémon name", []string{"pokemon"}, 1},
{"Another invalid command", []string{"invalid"}, 1},
}

for _, tt := range tests {
Expand Down
6 changes: 4 additions & 2 deletions cmd/ability/ability.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ability

import (
"errors"
"flag"
"fmt"
"os"
Expand Down Expand Up @@ -48,9 +49,10 @@ func AbilityCommand() (string, error) {
abilityName := strings.ToLower(args[2])

if err := af.FlagSet.Parse(args[3:]); err != nil {
if errors.Is(err, flag.ErrHelp) {
return output.String(), nil
}
fmt.Fprintf(&output, "error parsing flags: %v\n", err)
af.FlagSet.Usage()

return output.String(), err
}
Comment thread
digitalghost-dev marked this conversation as resolved.

Expand Down
6 changes: 6 additions & 0 deletions cmd/ability/ability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ func TestAbilityCommand(t *testing.T) {
args: []string{"ability", "poison-point"},
expectedOutput: utils.LoadGolden(t, "ability_poison_point.golden"),
},
{
name: "Ability invalid flag",
args: []string{"ability", "clear-body", "--bogus"},
expectedOutput: utils.LoadGolden(t, "ability_invalid_flag.golden"),
wantError: true,
},
}

for _, tt := range tests {
Expand Down
27 changes: 14 additions & 13 deletions cmd/berry/berry.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"os"
"strings"

"github.com/charmbracelet/bubbles/table"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"charm.land/bubbles/v2/table"
tea "charm.land/bubbletea/v2"
"charm.land/lipgloss/v2"
"github.com/digitalghost-dev/poke-cli/cmd/utils"
"github.com/digitalghost-dev/poke-cli/connections"
"github.com/digitalghost-dev/poke-cli/styling"
Expand Down Expand Up @@ -65,7 +65,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var bubbleCmd tea.Cmd

switch msg := msg.(type) {
case tea.KeyMsg:
case tea.KeyPressMsg:
switch msg.String() {
case "esc", "ctrl+c":
m.quitting = true
Expand All @@ -87,9 +87,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}

// View renders the current UI
func (m model) View() string {
func (m model) View() tea.View {
if m.quitting {
return "\n Goodbye! \n"
return tea.NewView("\n Goodbye! \n")
}

selectedBerry := ""
Expand All @@ -100,7 +100,7 @@ func (m model) View() string {
leftPanel := styling.TypesTableBorder.Render(m.table.View())

rightPanel := lipgloss.NewStyle().
Width(50).
Width(52).
Height(29).
Border(lipgloss.RoundedBorder()).
BorderForeground(styling.YellowColor).
Expand All @@ -109,18 +109,18 @@ func (m model) View() string {

screen := lipgloss.JoinHorizontal(lipgloss.Top, leftPanel, rightPanel)

return fmt.Sprintf("Highlight a berry!\n%s\n%s",
return tea.NewView(fmt.Sprintf("Highlight a berry!\n%s\n%s",
screen,
styling.KeyMenu.Render("↑ (move up) • ↓ (move down)\nctrl+c | esc (quit)"))
styling.KeyMenu.Render("↑ (move up) • ↓ (move down)\nctrl+c | esc (quit)")))
}

func tableGeneration() error {
namesList, err := connections.QueryBerryData(`
SELECT
SELECT
UPPER(SUBSTR(name, 1, 1)) || SUBSTR(name, 2)
FROM
berries
ORDER BY
FROM
berries
ORDER BY
name`)
if err != nil {
log.Fatalf("Failed to get berry names: %v", err)
Expand All @@ -136,6 +136,7 @@ func tableGeneration() error {
table.WithRows(rows),
table.WithFocused(true),
table.WithHeight(28),
table.WithWidth(16),
)

s := table.DefaultStyles()
Expand Down
33 changes: 18 additions & 15 deletions cmd/berry/berry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"testing"
"time"

"github.com/charmbracelet/bubbles/table"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/x/exp/teatest"
"charm.land/bubbles/v2/table"
tea "charm.land/bubbletea/v2"
"charm.land/lipgloss/v2"
"github.com/charmbracelet/x/exp/teatest/v2"
"github.com/digitalghost-dev/poke-cli/styling"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -74,6 +74,7 @@ func TestModelUpdate(t *testing.T) {
table.WithRows(rows),
table.WithFocused(true),
table.WithHeight(5),
table.WithWidth(16),
)

m := model{
Expand Down Expand Up @@ -124,15 +125,15 @@ func TestModelView(t *testing.T) {
}

view := m.View()
if view == "" {
if view.Content == "" {
t.Errorf("View() should not return empty string for normal state")
}

// Test quitting state
m.quitting = true
view = m.View()
if !strings.Contains(view, "Goodbye") {
t.Errorf("View() should contain 'Goodbye' when quitting, got %q", view)
if !strings.Contains(view.Content, "Goodbye") {
t.Errorf("View() should contain 'Goodbye' when quitting, got %q", view.Content)
}
}

Expand All @@ -145,6 +146,7 @@ func TestModelViewWithSelectedBerry(t *testing.T) {
table.WithRows(rows),
table.WithFocused(true),
table.WithHeight(5),
table.WithWidth(16),
)

m := model{
Expand All @@ -161,8 +163,8 @@ func TestModelViewWithSelectedBerry(t *testing.T) {
}

for _, element := range expectedElements {
if !strings.Contains(view, element) {
t.Errorf("View() should contain %q, got %q", element, view)
if !strings.Contains(view.Content, element) {
t.Errorf("View() should contain %q, got %q", element, view.Content)
}
}
}
Expand All @@ -182,6 +184,7 @@ func createTestModel() model {
table.WithRows(rows),
table.WithFocused(true),
table.WithHeight(5),
table.WithWidth(16),
)

s := table.DefaultStyles()
Expand All @@ -202,14 +205,14 @@ func TestTableNavigation(t *testing.T) {
testModel := teatest.NewTestModel(t, m, teatest.WithInitialTermSize(100, 50))

// Navigate down twice
testModel.Send(tea.KeyMsg{Type: tea.KeyDown})
testModel.Send(tea.KeyMsg{Type: tea.KeyDown})
testModel.Send(tea.KeyPressMsg{Code: tea.KeyDown})
testModel.Send(tea.KeyPressMsg{Code: tea.KeyDown})

// Navigate back up once
testModel.Send(tea.KeyMsg{Type: tea.KeyUp})
testModel.Send(tea.KeyPressMsg{Code: tea.KeyUp})

// Quit the program
testModel.Send(tea.KeyMsg{Type: tea.KeyCtrlC})
testModel.Send(tea.KeyPressMsg{Code: 'c', Mod: tea.ModCtrl})
testModel.WaitFinished(t, teatest.WithFinalTimeout(300*time.Millisecond))

final := testModel.FinalModel(t).(model)
Expand All @@ -229,7 +232,7 @@ func TestTableQuitWithEscape(t *testing.T) {
testModel := teatest.NewTestModel(t, m, teatest.WithInitialTermSize(100, 50))

// Quit with escape
testModel.Send(tea.KeyMsg{Type: tea.KeyEsc})
testModel.Send(tea.KeyPressMsg{Code: tea.KeyEscape})
testModel.WaitFinished(t, teatest.WithFinalTimeout(300*time.Millisecond))

final := testModel.FinalModel(t).(model)
Expand All @@ -244,7 +247,7 @@ func TestTableInitialSelection(t *testing.T) {
testModel := teatest.NewTestModel(t, m, teatest.WithInitialTermSize(100, 50))

// Don't navigate, just quit immediately
testModel.Send(tea.KeyMsg{Type: tea.KeyCtrlC})
testModel.Send(tea.KeyPressMsg{Code: 'c', Mod: tea.ModCtrl})
testModel.WaitFinished(t, teatest.WithFinalTimeout(300*time.Millisecond))

final := testModel.FinalModel(t).(model)
Expand Down
4 changes: 2 additions & 2 deletions cmd/berry/berryinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"strings"

"github.com/charmbracelet/lipgloss"
"charm.land/lipgloss/v2"
"github.com/digitalghost-dev/poke-cli/connections"
"github.com/digitalghost-dev/poke-cli/styling"
"github.com/disintegration/imaging"
Expand Down Expand Up @@ -95,7 +95,7 @@ func BerryImage(berryName string) string {
c2, _ := styling.MakeColor(img.At(x, heightCounter+1))
color2 := lipgloss.Color(c2.Hex())

styleKey := string(color1) + "_" + string(color2)
styleKey := c1.Hex() + "_" + c2.Hex()
style, exists := styleCache[styleKey]
if !exists {
style = lipgloss.NewStyle().Foreground(color1).Background(color2)
Expand Down
10 changes: 5 additions & 5 deletions cmd/card/card.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"strings"

tea "github.com/charmbracelet/bubbletea"
tea "charm.land/bubbletea/v2"
"github.com/digitalghost-dev/poke-cli/cmd/utils"
)

Expand Down Expand Up @@ -37,7 +37,7 @@ func CardCommand() (string, error) {
}

// Program 1: Series selection
finalModel, err := tea.NewProgram(SeriesList(), tea.WithAltScreen()).Run()
finalModel, err := tea.NewProgram(SeriesList()).Run()
if err != nil {
return "", fmt.Errorf("error running series selection program: %w", err)
}
Expand All @@ -54,7 +54,7 @@ func CardCommand() (string, error) {
return "", fmt.Errorf("error loading sets: %w", err)
}

finalSetsModel, err := tea.NewProgram(setsMdl, tea.WithAltScreen()).Run()
finalSetsModel, err := tea.NewProgram(setsMdl).Run()
if err != nil {
return "", fmt.Errorf("error running sets selection program: %w", err)
}
Expand All @@ -76,7 +76,7 @@ func CardCommand() (string, error) {
}

for {
finalCardsModel, err := tea.NewProgram(cardsMdl, tea.WithAltScreen()).Run()
finalCardsModel, err := tea.NewProgram(cardsMdl).Run()
if err != nil {
return "", fmt.Errorf("error running cards program: %w", err)
}
Expand All @@ -89,7 +89,7 @@ func CardCommand() (string, error) {
if cardsResult.ViewImage {
// Launch image viewer
imageURL := cardsResult.ImageMap[cardsResult.SelectedOption]
_, err := tea.NewProgram(ImageRenderer(cardsResult.SelectedOption, imageURL), tea.WithAltScreen()).Run()
_, err := tea.NewProgram(ImageRenderer(cardsResult.SelectedOption, imageURL)).Run()
if err != nil {
fmt.Fprintf(os.Stderr, "Warning: image viewer error: %v\n", err)
}
Expand Down
Loading
Loading