Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
timotheecour opened this issue Oct 16, 2020 · 2 comments
Labels
discussion [RFC] Fixes, APIs, or changes need feedback. external Issues with dependencies or otherwise unsolvable within the project itself.

Comments

@timotheecour
Copy link
Collaborator

timotheecour commented Oct 16, 2020

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)
@haltcase haltcase added discussion [RFC] Fixes, APIs, or changes need feedback. external Issues with dependencies or otherwise unsolvable within the project itself. labels Oct 16, 2020
@haltcase
Copy link
Owner

haltcase commented Oct 16, 2020

This relies on the outcome of nim-lang/Nim#15598 which would need to be accepted into Nim's standard library or elsewhere for this package to use it as a dependency.

@timotheecour
Copy link
Collaborator Author

timotheecour commented Oct 16, 2020

I mean on a technical level, wherever that linked PR ends (eg fusion or another nimble package)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion [RFC] Fixes, APIs, or changes need feedback. external Issues with dependencies or otherwise unsolvable within the project itself.
Projects
None yet
Development

No branches or pull requests

2 participants