rails / thor

Thor is a toolkit for building powerful command-line interfaces.
http://whatisthor.com/
MIT License
5.11k stars 552 forks source link

Update error message for content already exists case. #799

Closed jpgeek closed 1 year ago

jpgeek commented 1 year ago

🌈 The replace! method fails if the flag is not found OR if the text is already present. The error message only says that the flag has not been found. This is incorrect/misleading in the case where it has actually failed because the content is already present. This is pr just adds that to the error message.

Alternatively, could add a separate error message, change the return value from replace! to indicate the type of error but this seems like overkill.

jpgeek commented 1 year ago

I am also happy to branch the flow to a separate error message for the two cases along with a separate test if that is better.