use std::cli; use std::text; use vendor::savepoint_batch::savepoint_batch; fn main() { let arguments = cli_args(); if args_len(arguments) > 0 { if args_len(arguments) % 2 != 0 { stderr_line("Expected event and value pairs"); process_exit(2); } let mut live = savepoint_batch_start(); let mut i = 0; while i < args_len(arguments) { let input = args_at(arguments, i + 1); if !text_is_number(input) { stderr_line("Expected a whole numeric event value"); process_exit(2); } live = savepoint_batch_step(live, args_at(arguments, i), text_number(input)); let command = savepoint_batch_command(live); println!(command); if command == "reject" { process_exit(1); } i += 2; } return; } let mut state = savepoint_batch_start(); state = savepoint_batch_step(state, "begin", 0.0); println!(savepoint_batch_command(state)); state = savepoint_batch_step(state, "save", 0.0); println!(savepoint_batch_command(state)); state = savepoint_batch_step(state, "commit", 0.0); println!(savepoint_batch_command(state)); state = savepoint_batch_step(state, "rewind", 0.0); println!(savepoint_batch_command(state)); state = savepoint_batch_step(state, "commit", 0.0); println!(savepoint_batch_command(state)); }