-
Notifications
You must be signed in to change notification settings - Fork 23
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
Filesystem queries #20
Comments
Surely, a full featured |
I was mainly focused on the features I'm missing from bash. I have implementations for Do you have some suggestions for what those could be? For most other fs operations I'd probably just rely on existing commands and the flexibility they already offer through various arguments. They're not too weird to use either: # read a file
let mydata = ${ cat "/myfile" }.stdout
# delete a file
{ rm "/myfile" }
# write a file
{ echo "$mydata" > "/myfile" } On the other hand this marks my first bit of Rust - I'd be up for a challenge. |
Makes sense, I believe I would use the existing commands in most cases too. It would be nice to have the basic functionality in the standard library tho, just in case. Feel free to implement whichever methods you'd like. And by the way, congrats for your first bit of Rust 🦀 |
Fair point - some essential functions would be nice to have. I've listed the ones I could think of. Is there anything I've missed? |
For a 100% feature complete set, I'd consider Rust's own std::fs module:
|
Some of these would be collapsed into a single function, such as |
A lot of bash scripts rely on checking for the existence of files/dirs as pre-flight checks. E.g. something like:
If would be beneficial to be able to make the same kind of queries in hush - maybe something like
std.io.file_exists(...)
If it has interest I'll create a PR (and one for the docs as well)
The text was updated successfully, but these errors were encountered: