Skip to content

Commit 7481386

Browse files
adding deprecation message for '-t | --types' flag (#171)
1 parent 3ddd294 commit 7481386

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

flags/pokemonflagset.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func ImageFlag(w io.Writer, endpoint string, pokemonName string, size string) er
194194
// Validate size
195195
dimensions, exists := sizeMap[strings.ToLower(size)]
196196
if !exists {
197-
errMessage := styling.ErrorBorder.Render(styling.ErrorColor.Render("Error!"), "\nInvalid image size.\nValid sizes are: lg, md, sm")
197+
errMessage := styling.ErrorBorder.Render(styling.ErrorColor.Render("Error!"), "\nInvalid image size.\nValid sizes are: lg, md, sm")
198198
return fmt.Errorf("%s", errMessage)
199199
}
200200

@@ -477,5 +477,7 @@ func TypesFlag(w io.Writer, endpoint string, pokemonName string) error {
477477
}
478478
}
479479

480+
fmt.Fprintln(w, styling.WarningBorder.Render(styling.WarningColor.Render("⚠ Warning!"), "\nThe '-t | --types' flag is deprecated\nand will be removed in v2.\n\nTyping is now included by default.\nYou no longer need this flag. "))
481+
480482
return nil
481483
}

flags/pokemonflagset_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,14 @@ func TestTypesFlag(t *testing.T) {
262262
Typing
263263
Type 1: Grass
264264
Type 2: Poison
265+
╭─────────────────────────────────────╮
266+
│⚠ Warning! │
267+
│The '-t | --types' flag is deprecated│
268+
│and will be removed in v2. │
269+
│ │
270+
│Typing is now included by default. │
271+
│You no longer need this flag. │
272+
╰─────────────────────────────────────╯
265273
`
266274

267275
// Assert output contains the expected header and typing information

0 commit comments

Comments
 (0)