I am trying to build a simple cli tool (simple-cli
) to list contents of a directory. But I am running into an issue with the only function listed in the documentation that could potentially help with this:
The documentation for the above method states that it takes Str
as input. However, this results into an error from the compiler.
The argument is a string of type:
Str
But list needs its 1st argument to be:
InternalPath.InternalPath
Am I doing something incorrectly, here?
Here's the complete code:
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br" }
import pf.Task
import pf.Dir
import pf.StdOut
main =
entries = Dir.list! "/path/to/directory"
dbg entries
StdOut.line! "Finished scanning!"
Our docs need versioning apparently
0.10.0 Dir.list
takes a Path
So you would need Path.fromStr
I think the docs online are now for 0.11.0
of basic cli
@Anton any reason 0.11.0
is only a prerelease and not latest?
Also, url for 0.11.0: https://github.com/roc-lang/basic-cli/releases/download/0.11.0/SY4WWMhWQ9NvQgvIthcv15AUeA7rAIJHAHgiaSHGhdY.tar.br
Thanks @Brendan Hansknecht
The docs are already versioned.
Perhaps there was some old link that points to the docs of the main branch. Can you clarify how you ended up on the wrong docs site @Sajjad Naveed?
@Anton any reason
0.11.0
is only a prerelease and not latest?
0.11 contains some untested code, I'm almost done with setting up those tests.
@Anton I just followed the link from the roc-lang docs section but now it seems it's pointing to the updated docs. You can see the link above which I added in the post, previously it was showing list function (Dir) which took Str as the input but now it seems that has been fixed even on the link I shared.
Riight, that link, thanks! I'll make an issue to point that to the latest stable release.
Last updated: Jul 06 2025 at 12:14 UTC