toolkit: the tool program, read_file and write_file
Implemented-By: OpenCode session (model recorded in docs/implementer-log.md)
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
fn main() {
|
||||
eprintln!("toolkit: not implemented until M3");
|
||||
std::process::exit(2);
|
||||
use std::io::Write;
|
||||
use std::process::ExitCode;
|
||||
|
||||
fn main() -> ExitCode {
|
||||
let mut rest = std::env::args_os().skip(1);
|
||||
let name = match (rest.next(), rest.next()) {
|
||||
(Some(arg), None) => arg.to_str().unwrap_or("").to_string(),
|
||||
_ => String::new(),
|
||||
};
|
||||
|
||||
let outcome = toolkit::run(&name, &mut std::io::stdin().lock());
|
||||
let _ = std::io::stdout().write_all(outcome.stdout.as_bytes());
|
||||
let _ = std::io::stderr().write_all(outcome.stderr.as_bytes());
|
||||
ExitCode::from(outcome.exit.code())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user