glob
glob copied to clipboard
can walkGlobKinds be refactored to call something like glob from https://github.com/nim-lang/Nim/pull/15598 ?
followup from https://github.com/nim-lang/Nim/pull/15598#issuecomment-710501415
the idea would be to benefit from features introduced in https://github.com/nim-lang/Nim/pull/15598 by providing a wrapper around std/globs while retaining the same interface in pkg/glob
it would work like this:
# in pkg/glob
import std/globs
iterator walkGlobKinds* (
pattern: string | Glob,
root = "",
options = defaultGlobOptions,
filterDescend: FilterDescend = nil,
filterYield: FilterYield = nil
): GlobEntry =
proc filterDescend2(entry: PathEntry): bool = filterDescend(entry.path, entry.kind)
let dir = # compute from options
for entry in glob(dir, follow = filterDescend2, ...):
if filterYield(postprocess(entry)):
yield toGlobEntry(entry)
This relies on the outcome of https://github.com/nim-lang/Nim/pull/15598 which would need to be accepted into Nim's standard library or elsewhere for this package to use it as a dependency.
I mean on a technical level, wherever that linked PR ends (eg fusion or another nimble package)