rustshellscript

Joined 7 years ago

Karma
115
Submissions
19
Member since
Sep 27
https://github.com/rust-shell-script/rust_cmd_lib
View on Hacker News

Recent submissions

Comment · 3 years ago
Comment · 3 years ago
Comment · 5 years ago
Comment · 5 years ago
Comment · 5 years ago
Comment · 5 years ago
I have developed a similar library before: https://github.com/rust-shell-script/bash_cmd_lib/blob/maste... which can do temp files cleanup, different levels ofreporting and redirecting all error msgs into log file automatically.
Comment · 5 years ago
Thanks Steve. I have studied the "200 lines" book a few days ago, but was still confused. Only after seeing your talks, everything becomes so much clearer. These talks should really be part of the "async book" :)
Comment · 6 years ago
Comment · 6 years ago
Comment · 6 years ago
since run_cmd! and run_fun! are returning result type, you can always do let _ = run_cmd!(ls nofile); to ignore single command error.

The “xxx || true” is for ignoring error within a group of commands, which is also very common in sh “set -e” mode. Without it, the group of commands need to be divided into at least 3 parts to still capture all possible command errors. I probably need to document this part with more details.

Comment · 6 years ago
It can be supported with internal APIs, even without macros: Cmds::from_cmd(Cmd(...).current_dir(..)) .pipe(Cmd(...).current_dir(...)) .run_cmd(...)

As you can see, it is very verbose and that's why I choose to hide the lower APIs at this moment.

Comment · 6 years ago
Thanks, yes since I just finished the core functionality of this project and I am not surprised if it is still missing some critical features when converting bash script. Pls file bugs if you find anything :)
Comment · 6 years ago
You can consider it was enabled by default, and any failed command would return error unless you mask it with “xx || true”.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton