use std::cli; use std::text; use vendor::annotation_budget::annotation_budget; 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 = annotation_budget_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 = annotation_budget_step(live, args_at(arguments, i), text_number(input)); let command = annotation_budget_command(live); println!(command); if command == "reject" { process_exit(1); } i += 2; } return; } let mut state = annotation_budget_start(); state = annotation_budget_step(state, "fund", 10.0); println!(annotation_budget_command(state)); state = annotation_budget_step(state, "quote", 12.0); println!(annotation_budget_command(state)); state = annotation_budget_step(state, "quote", 4.0); println!(annotation_budget_command(state)); state = annotation_budget_step(state, "quote", 6.0); println!(annotation_budget_command(state)); state = annotation_budget_step(state, "extend", 3.0); println!(annotation_budget_command(state)); state = annotation_budget_step(state, "close", 0.0); println!(annotation_budget_command(state)); }