Expand description
This crate helps to automating command tools by simulating piped io in process.
§Usage
[dependencies]
altio = { version = "0.2", default-features = false }
[features]
altio = ["altio/altio"]
§Why this crate
Interactive command tools utilize stdin, stdout and stderr for communication. If you want to use command tools as libraries(no spawning processes) and tool authors agree, this crate can help to automating input/output, just 3 steps:
-
Define an
Altio
variable e.g.let io = Altio::default();
. -
Replace std APIs with altio’s equivalents, e.g. replace
println!(...)
withwriteln!( io.out(), ... )
, replacestd::io::stdin()
withio.input()
. -
Keep main.rs as simple as possible, e.g.
fn main() { the_tool::run( std::env::args_os() )}
.
§License
Under Apache License 2.0 or MIT License, at your will.
Macros§
- echo
- This macro
write
s formatted data into a buffer, or panic on failures. - impl_
altio_ output - Provides delegated
out()
/err()
methods for the type which contains a field namedaltio
.