Closed jbelyeu closed 5 years ago
we can also look into fnmatch module with can convert to a regexp.
Yeah, looked at that a little. Probably the best option.
ggd search has been changed and no longer uses glob.glob. Rather, it uses a fuzzy matching algorithm to identify package similar to the search terms.
Like list-files, search uses glob.glob to list files locally available. This introduces a slight internal inconsistency as results are verified by calling conda search, which treats patterns differently. Specifically, glob.glob supports shell-style wildcards (most usefully the * character to match anything), while conda search requires valid regex patterns (matching anywhere within the recipe name). Currently the script converts empty strings to * characters for glob and removes those * characters for conda search, as empty strings fail in glob. This is a fairly hack-feeling solution, however, that should be improved on.
Furthermore, if the user inputs a real, valid regex pattern, it will likely fail, because glob will treat the special characters it doesn't know as literals. This might be okay because they can use shell wildcards, but I think at the very least it needs to be well-documented and bulletproofed some more.