Skip to content

can walkGlobKinds be refactored to call something like glob from https://github.com/nim-lang/Nim/pull/15598 ? #47

@timotheecour

Description

@timotheecour

followup from nim-lang/Nim#15598 (comment)

the idea would be to benefit from features introduced in nim-lang/Nim#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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussion[RFC] Fixes, APIs, or changes need feedback.externalIssues with dependencies or otherwise unsolvable within the project itself.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions