#![forbid(unsafe_code)]
#![warn(missing_docs)]
pub mod inspect;
const USAGE: &str = "\
Tickwise: record, replay, and diff deterministic simulations.
Usage:
tickwise inspect <session.rec> show metadata and statistics for a recording
tickwise compare <a.rec> <b.rec> find the first divergent tick, arrives with M2
tickwise diff <a.dump> <b.dump> field-level structural diff, arrives with M3
Options:
-h, --help show this help
-V, --version show the version
";
pub fn run(args: &[String]) -> u8 {
let Some((command, rest)) = args.split_first() else {
eprint!("{USAGE}");
return 2;
};
match command.as_str() {
"inspect" => match rest {
[path] => match inspect::render(path) {
Ok(report) => {
print!("{}", report.text);
u8::from(report.corrupt)
}
Err(err) => {
eprintln!("tickwise inspect: {err}");
1
}
},
_ => {
eprintln!("usage: tickwise inspect <session.rec>");
2
}
},
"compare" => {
eprintln!("tickwise compare is not implemented yet, it arrives with M2");
1
}
"diff" => {
eprintln!("tickwise diff is not implemented yet, it arrives with M3");
1
}
"help" | "-h" | "--help" => {
print!("{USAGE}");
0
}
"-V" | "--version" => {
println!("tickwise {}", env!("CARGO_PKG_VERSION"));
0
}
other => {
eprintln!("tickwise: unknown command {other}");
eprint!("{USAGE}");
2
}
}
}