@@ -3,14 +3,15 @@ package ability
33import (
44 "flag"
55 "fmt"
6+ "os"
7+ "strings"
8+
69 "github.com/digitalghost-dev/poke-cli/cmd/utils"
710 "github.com/digitalghost-dev/poke-cli/connections"
811 "github.com/digitalghost-dev/poke-cli/flags"
912 "github.com/digitalghost-dev/poke-cli/styling"
1013 "golang.org/x/text/cases"
1114 "golang.org/x/text/language"
12- "os"
13- "strings"
1415)
1516
1617func AbilityCommand () (string , error ) {
@@ -52,18 +53,12 @@ func AbilityCommand() (string, error) {
5253 if err := abilityFlags .Parse (args [3 :]); err != nil {
5354 output .WriteString (fmt .Sprintf ("error parsing flags: %v\n " , err ))
5455 abilityFlags .Usage ()
55- if os .Getenv ("GO_TESTING" ) != "1" {
56- os .Exit (1 )
57- }
56+
5857 return output .String (), err
5958 }
6059
6160 abilitiesStruct , abilityName , err := connections .AbilityApiCall (endpoint , abilityName , connections .APIURL )
6261 if err != nil {
63- if os .Getenv ("GO_TESTING" ) != "1" {
64- fmt .Fprintln (os .Stderr , err )
65- os .Exit (1 )
66- }
6762 return err .Error (), nil
6863 }
6964
@@ -88,7 +83,6 @@ func AbilityCommand() (string, error) {
8883 capitalizedAbility := cases .Title (language .English ).String (strings .ReplaceAll (abilityName , "-" , " " ))
8984 output .WriteString (styling .StyleBold .Render (capitalizedAbility ) + "\n " )
9085
91- // Print the generation where the ability was first introduced.
9286 generationParts := strings .Split (abilitiesStruct .Generation .Name , "-" )
9387 if len (generationParts ) > 1 {
9488 generationUpper := strings .ToUpper (generationParts [1 ])
@@ -100,9 +94,9 @@ func AbilityCommand() (string, error) {
10094 // API is missing some data for the short_effect for abilities from Generation 9.
10195 // If short_effect is empty, fallback to the move's flavor_text_entry.
10296 if englishShortEffect == "" {
103- output .WriteString (fmt .Sprintf ("%s Effect: " + englishFlavorEntry , styling .ColoredBullet ))
97+ output .WriteString (fmt .Sprintf ("%s Effect: %s" , styling .ColoredBullet , englishFlavorEntry ))
10498 } else {
105- output .WriteString (fmt .Sprintf ("%s Effect: " + englishShortEffect , styling .ColoredBullet ))
99+ output .WriteString (fmt .Sprintf ("%s Effect: %s" , styling .ColoredBullet , englishShortEffect ))
106100 }
107101
108102 if * pokemonFlag || * shortPokemonFlag {
0 commit comments