Skip to content

Conversation

@tmck-code
Copy link
Owner

@tmck-code tmck-code commented Nov 12, 2025

There is a minor bug where some pokemon names that are subsets of others end up returning that superset name, e.g.

  • natu & eternatus (natu will return eternatus too)
  • mew & mewtwo (mew will return mewtwo too)
  • etc

  • This updates the logic to ensure this doesn't happen
  • I also added some unit tests for this behaviour
  • I was thinking of using regexp instead but it turned out to be hella slow in comparison

before

☯ pokesay --list-names=mew                                                              {
  "mew": {
    "0490.0578": "medium, gen7x, regular",
    "0490.0579": "medium, gen7x, regular",
    "0490.0580": "medium, gen7x, regular",
    "0490.0581": "small, gen7x, regular",
    "0490.1736": "medium, gen7x, shiny",
    "0490.1737": "medium, gen7x, shiny",
    "0490.1738": "medium, gen7x, shiny",
    "0490.1739": "small, gen7x, shiny",
    "0490.3127": "medium, gen8, regular",
    "0490.3128": "medium, gen8, regular",
    "0490.3129": "medium, gen8, regular",
    "0490.3130": "big, gen8, regular",
    "0490.4452": "medium, gen8, shiny",
    "0490.4453": "medium, gen8, shiny",
    "0490.4454": "medium, gen8, shiny",
    "0490.4455": "big, gen8, shiny"
  }
}

after

☯ ./pokesay --list-names=mew
{
  "mew": {
    "0490.0577": "medium, gen7x, regular",
    "0490.1718": "medium, gen7x, shiny"
  }
}                                                                                        

@tmck-code tmck-code merged commit 76f3efc into master Nov 12, 2025
1 check passed
@tmck-code tmck-code deleted the similar-name-bugfix branch November 12, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants