Skip to content

add walkDirRecFilter recursive glob with follow filter (has full implementation) #261

@timotheecour

Description

@timotheecour

proposal

I wrote this lib/std/private/globs.nim some time ago for use in kochdocs; this RFC is to move it to stdlib inside os.nim or a new std/globs.nim

design rationale

  • only a follow filter is needed; user code can without loss of generality filter the iterator output so we don't need a yieldFilter (as done in pkg/glob (/cc @citycide see http://bolingen.me/glob/latest/glob.html) or even a selection for pcFile, pcDir etc (as done in os.walkDirRec): this can all be done in client code (unlike what's done in follow filter since it'd be "too late").
  • walkDirRec can be re-written by calling walkDirRecFilter (and could be deprecated maybe)

discussion

  • better names welcome; maybe s/walkDirRecFilter/glob ?
  • in future work I want to allow adding a sortBy = cmp (by a user defined unary or binary cmp proc); this could be done by doing a bit of refactoring by adding std/sorts so that os can import std/sorts and std/algorithm can import std/sorts, to avoid too much dependencies in std/os
  • alternative is to move walkDirRecFilter to a new module std/globs ; it might be better but that would prevent de-duping walkDirRec
  • it could be moved to fusion/globs but that requires accepting RFC: fusion should be importable by compiler sources, and even stdlib and koch fusion#22 so that kochdocs can import fusion/globs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions