https://github.com/wberrier/shleazy
https://github.com/wberrier/shleazy
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/wberrier/shleazy
- Owner: wberrier
- Created: 2025-01-18T07:23:03.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-01-27T07:25:39.000Z (4 months ago)
- Last Synced: 2025-03-29T02:21:42.244Z (about 2 months ago)
- Language: Rust
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# shleazy
"Shell Made Easy"
There are several `std::process` wrappers, but all seem too verbose for
some common use cases.`_shell` variants wrap command in `sh -c ''`.
## Examples
```rust
use shleazy::*;fn main() -> Result<()> {
// Returns Err since non-zero exit code
run_shell_or_err("ls /invalid-path")?;// Returns 1
let exit_code = getstatus_shell("false")?;// Returns "test"
let output = getoutput_shell_or_err("echo 'test'")?;// Returns (0, "test")
let (exit_code, output) = getstatusoutput_shell("echo 'test'")?;
}```
## TODO
* add async feature? Or shleazy-async?
* use procedural macro for args to avoid `format!()` with shell variants
* flesh out all combinations (existing implemented as needed)
* capture/combine `stderr`
* model around a struct instead? (Seems more verbose?), for example:```rust
Cmd::new("").
Cmd::new_shell("").
Cmd::new_args("", "arg1").
Cmd::new("").output()
Cmd::new("").output_or_err()
Cmd::new("").status()
Cmd::new("").status_or_err()
Cmd::new("").or_err()
Cmd::new("").statusoutput()
Cmd::new("").statusoutput_or_err()
```