Gabriella439 / turtle

Shell programming, Haskell style
BSD 3-Clause "New" or "Revised" License
942 stars 90 forks source link

Pattern for `find` requires search directory prefix #387

Open theNerd247 opened 4 years ago

theNerd247 commented 4 years ago

Reporting this as a note. @Gabriel439 remind me to put a PR in for this sometime. Here's the problem:

 find (decimal *> ".md") "./md"

Is my first intuition for searching for all markdown files with a decimal only name in a given directory. However this Pattern fails because it is required to match the entire path. However, the following works

 find ("./md/" *> decimal *> ".md") "./md"

This seems counter-intuitive to what find should be doing: matching against only the basename of a file as apposed to the relative path from the CWD.

Gabriella439 commented 4 years ago

This is intentional, even if it does differ from the behavior of Unix find. You can do find (suffix (decimal *> ".md")) if you want to match against a suffix

theNerd247 commented 4 years ago

Gotcha. Mind if it add this to the Haddock? I think it would make it easier for those coming from writing Bash scripts.

Gabriella439 commented 4 years ago

@theNerd247: Yeah, definitely! 🙂