Open MarinX opened 1 month ago
Thank you for the pull request! Based on quick testing in a terminal, this seems to fix the resolving part of #102. However, this would now be a breaking change for users that have resources named so that there is difference only in letter case (e.g., McDuck
and mcduck
), but that should be quite unlikely.
upctl router create --name mcduck
upctl router create --name McDuck
upctl router show McDuck
# Succeeds with case-sensitive matching, fails with case-insensitive matching
One option would be to use case-sensitive match in this case, but not sure how big change that would require in the resolver that calls the MatchArgWithWhitespace
function 🤔
You are correct that this is breaking change. Especially for users with the same names but different casing. (unlikely but potential bug here)
What about adding a --insensitive
flag?
upctl router show --insensitive mcduck
So, without a flag, the show command will function as is, while adding --insensitive
, will trigger matching words without casing.
But, this is related only to insensitive names and its purpose is only 1 thing.
Another option is to maybe add regex to the show command. Something like this
upctl router show --regex mc[a-z]+
Where we can call the regex and return the first match. Maybe I am overengineer this too much, but thinking out loud.
Let me know your thoughts or if you have some other ideas we can discuss :)
Sorry about the delay with this. I'll try to continue looking into this during next week.
Fixes #102
Added strings.EqualFold to
MatchArgWithWhitespace
function name. Added tests formatchers.go
file.