Skip to content

Commit cc4ab7b

Browse files
Merge pull request #92 from digitalghost-dev/0.10.0
0.10.0
2 parents fd01527 + ed1f694 commit cc4ab7b

File tree

17 files changed

+328
-101
lines changed

17 files changed

+328
-101
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ on:
2525
- main
2626

2727
env:
28-
VERSION_NUMBER: 'v0.9.3'
28+
VERSION_NUMBER: 'v0.10.0'
2929
DOCKERHUB_REGISTRY_NAME: 'digitalghostdev/poke-cli'
3030
AWS_REGION: 'us-west-2'
3131

.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=v0.9.3
17+
- -s -w -X main.version=v0.10.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=v0.9.3" -o poke-cli .
11+
RUN go build -ldflags "-X main.version=v0.10.0" -o poke-cli .
1212

1313
# build 2
1414
FROM gcr.io/distroless/static-debian12:nonroot

README.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img height="250" width="350" src="https://cdn.simpleicons.org/pokemon/FFCC00" 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/v0.9.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/v0.10.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">
@@ -15,11 +15,11 @@
1515
A CLI tool for viewing data about Pokémon from your terminal! I am new to writing Go and taking my time in building this
1616
project.
1717

18-
My aim is to have four commands finished for `v1.0.0`. Read more in the [Roadmap](#roadmap) section.
18+
My aim is to have five commands finished for `v1.0.0`. Read more in the [Roadmap](#roadmap) section.
1919

2020
---
2121
## Demo
22-
![demo](https://poke-cli-s3-bucket.s3.us-west-2.amazonaws.com/demo-v0.9.3.gif)
22+
![demo](https://poke-cli-s3-bucket.s3.us-west-2.amazonaws.com/demo-v0.10.0.gif)
2323

2424
---
2525
## Install
@@ -68,7 +68,7 @@ _Use a Docker Image_
6868
* Necessary.
6969

7070
```bash
71-
docker run --rm -i -t digitalghostdev/poke-cli:v0.9.3 <command> [subcommand] flag]
71+
docker run --rm -i -t digitalghostdev/poke-cli:v0.10.0 <command> [subcommand] flag]
7272
```
7373

7474
### Go Install
@@ -83,23 +83,25 @@ _If you have Go already, install the executable yourself_
8383
## Usage
8484
By running `poke-cli [-h | --help]`, it'll display information on how to use the tool.
8585
```
86-
╭────────────────────────────────────────────────────────╮
87-
│Welcome! This tool displays data related to Pokémon! │
88-
│ │
89-
│ USAGE: │
90-
│ poke-cli [flag] │
91-
│ poke-cli <command> [flag] │
92-
│ poke-cli <command> <subcommand> [flag] │
93-
│ │
94-
│ FLAGS: │
95-
│ -h, --help Shows the help menu │
96-
│ -l, --latest Prints the latest version available │
97-
│ -v, --version Prints the current version │
98-
│ │
99-
│ AVAILABLE COMMANDS: │
100-
│ pokemon Get details of a specific Pokémon │
101-
│ types Get details of a specific typing │
102-
╰────────────────────────────────────────────────────────╯
86+
╭─────────────────────────────────────────────────────────╮
87+
│Welcome! This tool displays data related to Pokémon! │
88+
│ │
89+
│ USAGE: │
90+
│ poke-cli [flag] │
91+
│ poke-cli <command> [flag] │
92+
│ poke-cli <command> <subcommand> [flag] │
93+
│ │
94+
│ FLAGS: │
95+
│ -h, --help Shows the help menu │
96+
│ -l, --latest Prints the latest version available │
97+
│ -v, --version Prints the current version │
98+
│ │
99+
│ COMMANDS: │
100+
│ natures Get details about Pokémon natures │
101+
│ pokemon Get details about a specific Pokémon │
102+
│ types Get details about a specific typing │
103+
╰─────────────────────────────────────────────────────────╯
104+
103105
```
104106

105107
---
@@ -112,13 +114,15 @@ The architecture behind how the tool works is straight forward.
112114

113115
_Not 100% up-to-date, may add or remove some of these choices_
114116

117+
- [ ] `ability`: get data about a specific ability.
118+
- [ ] `-p | --pokemon`: display Pokémon that learn this ability.
119+
- [ ] `move`: get data about a specific move.
120+
- [ ] `-p | --pokemon`: display Pokémon that learn this move.
121+
- [x] `natures`: get data about natures.
115122
- [ ] `pokemon`: get data about a specific Pokémon.
116123
- [x] `-a | --abilities`: display the Pokémon's abilities.
124+
- [ ] `-i | --image`: display a pixel image of the Pokémon.
117125
- [x] `-s | --stats`: display the Pokémon's base stats.
118126
- [x] `-t | --types`: display the Pokémon's typing.
119127
- [ ] `-m | --moves`: display learnable moves.
120128
- [x] `types`: get data about a specific typing.
121-
- [ ] `ability`: get data about a specific ability.
122-
- [ ] `-p | --pokemon`: display Pokémon that learn this ability.
123-
- [ ] `move`: get data about a specific move.
124-
- [ ] `-p | --pokemon`: display Pokémon that learn this move.

cli.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ func runCLI(args []string) int {
6666
fmt.Sprintf("\n\t%-15s %s", "-h, --help", "Shows the help menu"),
6767
fmt.Sprintf("\n\t%-15s %s", "-l, --latest", "Prints the latest version available"),
6868
fmt.Sprintf("\n\t%-15s %s", "-v, --version", "Prints the current version"),
69-
"\n\n", styleBold.Render("AVAILABLE COMMANDS:"),
70-
fmt.Sprintf("\n\t%-15s %s", "pokemon", "Get details of a specific Pokémon"),
71-
fmt.Sprintf("\n\t%-15s %s", "types", "Get details of a specific typing"),
69+
"\n\n", styleBold.Render("COMMANDS:"),
70+
fmt.Sprintf("\n\t%-15s %s", "natures", "Get details about Pokémon natures"),
71+
fmt.Sprintf("\n\t%-15s %s", "pokemon", "Get details about a specific Pokémon"),
72+
fmt.Sprintf("\n\t%-15s %s", "types", "Get details about a specific typing"),
7273
)
7374
fmt.Println(helpMessage)
7475
}
@@ -91,6 +92,7 @@ func runCLI(args []string) int {
9192

9293
commands := map[string]func(){
9394
"pokemon": cmd.PokemonCommand,
95+
"natures": cmd.NaturesCommand,
9496
"types": cmd.TypesCommand,
9597
}
9698

@@ -111,10 +113,11 @@ func runCLI(args []string) int {
111113
errMessage := errorBorder.Render(
112114
errorColor.Render("Error!"),
113115
fmt.Sprintf("\n\t%-15s", fmt.Sprintf("'%s' is not a valid command.\n", command)),
114-
styleBold.Render("\nAvailable Commands:"),
115-
fmt.Sprintf("\n\t%-15s %s", "pokemon", "Get details of a specific Pokémon"),
116-
fmt.Sprintf("\n\t%-15s %s", "types", "Get details of a specific typing\n"),
117-
fmt.Sprintf("\nAlso run %s for more info!", styleBold.Render("[poke-cli -h]")),
116+
styleBold.Render("\nCommands:"),
117+
fmt.Sprintf("\n\t%-15s %s", "natures", "Get details about Pokémon natures"),
118+
fmt.Sprintf("\n\t%-15s %s", "pokemon", "Get details about a specific Pokémon"),
119+
fmt.Sprintf("\n\t%-15s %s", "types", "Get details about a specific typing"),
120+
fmt.Sprintf("\n\nAlso run %s for more info!", styleBold.Render("poke-cli -h")),
118121
)
119122
fmt.Printf("%s\n", errMessage)
120123
return 1

cli_test.go

Lines changed: 57 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ func TestCurrentVersion(t *testing.T) {
6464
}
6565
}
6666

67-
var ansiRegex = regexp.MustCompile(`\x1b\[[0-9;]*m`)
68-
6967
func captureOutput(f func()) string {
7068
var buf bytes.Buffer
7169
stdout := os.Stdout
@@ -82,6 +80,8 @@ func captureOutput(f func()) string {
8280
}
8381

8482
func stripANSI(input string) string {
83+
// Regular expression to match ANSI escape sequences
84+
ansiRegex := regexp.MustCompile(`\x1b\[[0-9;]*m`)
8585
return ansiRegex.ReplaceAllString(input, "")
8686
}
8787

@@ -95,67 +95,70 @@ func TestRunCLI(t *testing.T) {
9595
{
9696
name: "No Arguments",
9797
args: []string{},
98-
expectedOutput: "╭────────────────────────────────────────────────────────╮\n" +
99-
"│Welcome! This tool displays data related to Pokémon! │\n" +
100-
"│ │\n" +
101-
"│ USAGE: │\n" +
102-
"│ poke-cli [flag] │\n" +
103-
"│ poke-cli <command> [flag] │\n" +
104-
"│ poke-cli <command> <subcommand> [flag] │\n" +
105-
"│ │\n" +
106-
"│ FLAGS: │\n" +
107-
"│ -h, --help Shows the help menu │\n" +
108-
"│ -l, --latest Prints the latest version available │\n" +
109-
"│ -v, --version Prints the current version │\n" +
110-
"│ │\n" +
111-
"│ AVAILABLE COMMANDS: │\n" +
112-
"│ pokemon Get details of a specific Pokémon │\n" +
113-
"│ types Get details of a specific typing │\n" +
114-
"╰────────────────────────────────────────────────────────╯\n",
98+
expectedOutput: "╭─────────────────────────────────────────────────────────╮\n" +
99+
"│Welcome! This tool displays data related to Pokémon! │\n" +
100+
"│ │\n" +
101+
"│ USAGE: │\n" +
102+
"│ poke-cli [flag] │\n" +
103+
"│ poke-cli <command> [flag] │\n" +
104+
"│ poke-cli <command> <subcommand> [flag] │\n" +
105+
"│ │\n" +
106+
"│ FLAGS: │\n" +
107+
"│ -h, --help Shows the help menu │\n" +
108+
"│ -l, --latest Prints the latest version available │\n" +
109+
"│ -v, --version Prints the current version │\n" +
110+
"│ │\n" +
111+
"│ COMMANDS: │\n" +
112+
"│ natures Get details about Pokémon natures │\n" +
113+
"│ pokemon Get details about a specific Pokémon │\n" +
114+
"│ types Get details about a specific typing │\n" +
115+
"╰─────────────────────────────────────────────────────────╯\n",
115116
expectedCode: 0,
116117
},
117118
{
118119
name: "Help Flag Short",
119120
args: []string{"-h"},
120-
expectedOutput: "╭────────────────────────────────────────────────────────╮\n" +
121-
"│Welcome! This tool displays data related to Pokémon! │\n" +
122-
"│ │\n" +
123-
"│ USAGE: │\n" +
124-
"│ poke-cli [flag] │\n" +
125-
"│ poke-cli <command> [flag] │\n" +
126-
"│ poke-cli <command> <subcommand> [flag] │\n" +
127-
"│ │\n" +
128-
"│ FLAGS: │\n" +
129-
"│ -h, --help Shows the help menu │\n" +
130-
"│ -l, --latest Prints the latest version available │\n" +
131-
"│ -v, --version Prints the current version │\n" +
132-
"│ │\n" +
133-
"│ AVAILABLE COMMANDS: │\n" +
134-
"│ pokemon Get details of a specific Pokémon │\n" +
135-
"│ types Get details of a specific typing │\n" +
136-
"╰────────────────────────────────────────────────────────╯\n",
121+
expectedOutput: "╭─────────────────────────────────────────────────────────╮\n" +
122+
"│Welcome! This tool displays data related to Pokémon! │\n" +
123+
"│ │\n" +
124+
"│ USAGE: │\n" +
125+
"│ poke-cli [flag] │\n" +
126+
"│ poke-cli <command> [flag] │\n" +
127+
"│ poke-cli <command> <subcommand> [flag] │\n" +
128+
"│ │\n" +
129+
"│ FLAGS: │\n" +
130+
"│ -h, --help Shows the help menu │\n" +
131+
"│ -l, --latest Prints the latest version available │\n" +
132+
"│ -v, --version Prints the current version │\n" +
133+
"│ │\n" +
134+
"│ COMMANDS: │\n" +
135+
"│ natures Get details about Pokémon natures │\n" +
136+
"│ pokemon Get details about a specific Pokémon │\n" +
137+
"│ types Get details about a specific typing │\n" +
138+
"╰─────────────────────────────────────────────────────────╯\n",
137139
expectedCode: 0,
138140
},
139141
{
140142
name: "Help Flag Long",
141143
args: []string{"--help"},
142-
expectedOutput: "╭────────────────────────────────────────────────────────╮\n" +
143-
"│Welcome! This tool displays data related to Pokémon! │\n" +
144-
"│ │\n" +
145-
"│ USAGE: │\n" +
146-
"│ poke-cli [flag] │\n" +
147-
"│ poke-cli <command> [flag] │\n" +
148-
"│ poke-cli <command> <subcommand> [flag] │\n" +
149-
"│ │\n" +
150-
"│ FLAGS: │\n" +
151-
"│ -h, --help Shows the help menu │\n" +
152-
"│ -l, --latest Prints the latest version available │\n" +
153-
"│ -v, --version Prints the current version │\n" +
154-
"│ │\n" +
155-
"│ AVAILABLE COMMANDS: │\n" +
156-
"│ pokemon Get details of a specific Pokémon │\n" +
157-
"│ types Get details of a specific typing │\n" +
158-
"╰────────────────────────────────────────────────────────╯\n",
144+
expectedOutput: "╭─────────────────────────────────────────────────────────╮\n" +
145+
"│Welcome! This tool displays data related to Pokémon! │\n" +
146+
"│ │\n" +
147+
"│ USAGE: │\n" +
148+
"│ poke-cli [flag] │\n" +
149+
"│ poke-cli <command> [flag] │\n" +
150+
"│ poke-cli <command> <subcommand> [flag] │\n" +
151+
"│ │\n" +
152+
"│ FLAGS: │\n" +
153+
"│ -h, --help Shows the help menu │\n" +
154+
"│ -l, --latest Prints the latest version available │\n" +
155+
"│ -v, --version Prints the current version │\n" +
156+
"│ │\n" +
157+
"│ COMMANDS: │\n" +
158+
"│ natures Get details about Pokémon natures │\n" +
159+
"│ pokemon Get details about a specific Pokémon │\n" +
160+
"│ types Get details about a specific typing │\n" +
161+
"╰─────────────────────────────────────────────────────────╯\n",
159162
expectedCode: 0,
160163
},
161164
{
@@ -167,7 +170,7 @@ func TestRunCLI(t *testing.T) {
167170
{
168171
name: "Latest Flag",
169172
args: []string{"-l"},
170-
expectedOutput: "Latest Docker image version: v0.9.2\nLatest release tag: v0.9.2\n",
173+
expectedOutput: "Latest Docker image version: v0.9.3\nLatest release tag: v0.9.3\n",
171174
expectedCode: 0,
172175
},
173176
}

0 commit comments

Comments
 (0)