Gabriella439 / turtle

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

Feature proposal: gfind #298

Open cfhammill opened 6 years ago

cfhammill commented 6 years ago

I think having a more full featured find utility would be great.

I figured I'd post a plan to get ideas before I start trying to write it. In my head it's gfind because it's going to implement more of the features of gnu find.

Desired Features (a start at)

Implementation concerns

A feature rich find would have a huge number of parameters most of which wouldn't be necessary for every use. So optional arguments are almost definitely necessary. I think an approach inspired by: http://neilmitchell.blogspot.ca/2008/04/optional-parameters-in-haskell.html could be useful.

To avoid namespacing issues we could use vinyl records, an example might look like:

gfind path (chars) ((MinDepth ==: 1) :& (MaxDepth == : 1))

A global set of defaults can be defined by the package and the users options can be integrated with the defaults via rreplace

Any thoughts and suggestions would be appreciated.

Gabriella439 commented 6 years ago

My intution is that if we design this correctly we won't need to have many parameters. Some of these desired features could be split out into orthogonal utilities. In the spirit of the Unix philosophy we want each utility to do one thing and do it well!

Specifically, I think you could split it up like this:

cfhammill commented 6 years ago

That seems like a better way to structure this, I'll give writing it a shot and report back.