Skip to content

Use fnmatch in trailing ' *' fallback for glob patterns#118

Merged
ldayton merged 1 commit intomainfrom
fix/110-trailing-star-fnmatch
Mar 22, 2026
Merged

Use fnmatch in trailing ' *' fallback for glob patterns#118
ldayton merged 1 commit intomainfrom
fix/110-trailing-star-fnmatch

Conversation

@ldayton
Copy link
Copy Markdown
Owner

@ldayton ldayton commented Mar 22, 2026

Summary

  • The trailing * fallback (which lets python * match bare python) used == to compare the base pattern against the command
  • When the base pattern contained glob characters (e.g. tea issue* close), the == comparison failed because * wasn't interpreted
  • Now uses fnmatch() with a guard: skips the fallback when the base pattern matches the empty string (e.g. bare *), preventing * * from matching every command

Fixes both match_command and match_after code paths.

Closes #110

The trailing ' *' fallback for bare commands used == instead of
fnmatch, so glob characters in the base pattern were not interpreted.
e.g. 'tea issue* close *' failed to match bare 'tea issues close'.

Guard against degenerate bases (like bare '*') by skipping the
fallback when the base pattern matches the empty string.

Closes #110
@ldayton ldayton merged commit 4095f61 into main Mar 22, 2026
1 check passed
@ldayton ldayton deleted the fix/110-trailing-star-fnmatch branch March 22, 2026 19:08
@vtmocanu
Copy link
Copy Markdown

Thank you @ldayton ❤️

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.

Trailing ' *' fallback should use fnmatch instead of exact match

2 participants