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

Update walkdir / walkpath in API table #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kescobo
Copy link

@kescobo kescobo commented Sep 16, 2021

walkpath does not exist in Base, and walkdir has a different behavior, so I wasn't sure if I should make this two rows or treat them as equivalent.

Edit: this is the 1-row version. The two row version I'd propose would be

walkdir | N/A
N/A     | walkpath

examples:

julia> p = "docs"
"docs"

julia> for item in walkdir(p)
           @show item
       end
item = ("docs", ["src"], ["Project.toml", "make.jl"])
item = ("docs/src", String[], ["index.md"])

julia> for item in walkpath(p)
           @show item
       end
ERROR: UndefVarError: walkpath not defined
Stacktrace:
 [1] top-level scope
   @ ./REPL[3]:1

julia> using FilePaths

julia> for item in walkpath(p)
           @show item
       end
ERROR: MethodError: no method matching walkpath(::String)
Closest candidates are:
  walkpath(::P; topdown, follow_symlinks, onerror) where P<:AbstractPath at /home/kevin/.julia/packages/FilePathsBase/YFK4h/src/pat
h.jl:709
Stacktrace:
 [1] top-level scope
   @ ./REPL[5]:1

julia> for item in walkpath(Path(p))
           @show item
       end
item = p"docs/Project.toml"
item = p"docs/make.jl"
item = p"docs/src"
item = p"docs/src/index.md"

`walkpath` does not exist in `Base`, and `walkdir` has a different behavior, so I wasn't sure if I should make this two rows or treat them as equivalent.

```
julia> p = "docs"
"docs"

julia> for item in walkdir(p)
           @show item
       end
item = ("docs", ["src"], ["Project.toml", "make.jl"])
item = ("docs/src", String[], ["index.md"])

julia> for item in walkpath(p)
           @show item
       end
ERROR: UndefVarError: walkpath not defined
Stacktrace:
 [1] top-level scope
   @ ./REPL[3]:1

julia> using FilePaths

julia> for item in walkpath(p)
           @show item
       end
ERROR: MethodError: no method matching walkpath(::String)
Closest candidates are:
  walkpath(::P; topdown, follow_symlinks, onerror) where P<:AbstractPath at /home/kevin/.julia/packages/FilePathsBase/YFK4h/src/pat
h.jl:709
Stacktrace:
 [1] top-level scope
   @ ./REPL[5]:1

julia> for item in walkpath(Path(p))
           @show item
       end
item = p"docs/Project.toml"
item = p"docs/make.jl"
item = p"docs/src"
item = p"docs/src/index.md"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant