@@ -10,8 +10,6 @@ import (
1010 "github.com/digitalghost-dev/poke-cli/connections"
1111 "github.com/digitalghost-dev/poke-cli/flags"
1212 "github.com/digitalghost-dev/poke-cli/styling"
13- "golang.org/x/text/cases"
14- "golang.org/x/text/language"
1513)
1614
1715func AbilityCommand () (string , error ) {
@@ -22,7 +20,7 @@ func AbilityCommand() (string, error) {
2220 "Get details about a specific ability.\n \n " ,
2321 styling .StyleBold .Render ("USAGE:" ),
2422 fmt .Sprintf ("\n \t %s %s %s %s" , "poke-cli" , styling .StyleBold .Render ("ability" ), "<ability-name>" , "[flag]" ),
25- fmt .Sprintf ("\n \t %-30s" , styling .StyleItalic .Render ("Use a hyphen when typing a name with a space." )),
23+ fmt .Sprintf ("\n \t %-30s" , styling .StyleItalic .Render (styling . HyphenHint )),
2624 "\n \n " ,
2725 styling .StyleBold .Render ("FLAGS:" ),
2826 fmt .Sprintf ("\n \t %-30s %s" , "-p, --pokemon" , "Prints Pokémon that learn this ability." ),
@@ -35,13 +33,12 @@ func AbilityCommand() (string, error) {
3533
3634 args := os .Args
3735
38- flag .Parse ()
39-
40- if len (os .Args ) == 3 && (os .Args [2 ] == "-h" || os .Args [2 ] == "--help" ) {
41- flag .Usage ()
36+ if utils .CheckHelpFlag (& output , flag .Usage ) {
4237 return output .String (), nil
4338 }
4439
40+ flag .Parse ()
41+
4542 if err := utils .ValidateAbilityArgs (args ); err != nil {
4643 output .WriteString (err .Error ())
4744 return output .String (), err
@@ -81,7 +78,7 @@ func AbilityCommand() (string, error) {
8178 }
8279 }
8380
84- capitalizedAbility := cases . Title ( language . English ). String ( strings . ReplaceAll ( abilityName , "-" , " " ) )
81+ capitalizedAbility := styling . CapitalizeResourceName ( abilityName )
8582 output .WriteString (styling .StyleBold .Render (capitalizedAbility ) + "\n " )
8683
8784 generationParts := strings .Split (abilitiesStruct .Generation .Name , "-" )
0 commit comments